Nuget metadata #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI-CD | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
workflow_dispatch: | |
env: | |
ARTIFACT_NAME: daad-nuget-artifact | |
SOLUTION: DefaultAzureAuthDebug.sln | |
CLI_TOOL_PROJ_PATH: src/Console/Console.csproj | |
jobs: | |
build: | |
name: Build cli tool package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v1.1.1 | |
with: | |
versionSpec: '5.x' | |
- name: Determine new version | |
uses: gittools/actions/gitversion/execute@v1.1.1 | |
with: | |
useConfigFile: true | |
configFilePath: GitVersion.yml | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
global-json-file: ./global.json | |
- name: Restore solution | |
run: dotnet restore ${{ env.SOLUTION }} | |
- name: Build solution | |
run: dotnet build --no-restore --configuration Release ${{ env.SOLUTION }} | |
- name: Pack the cli tool | |
run: dotnet pack --configuration Release -o ./dist -p:Version=$GitVersion_NuGetVersion ${{ env.CLI_TOOL_PROJ_PATH }} | |
- name: Publish artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: dist | |
publish: | |
name: Publish package to NuGet | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: dist | |
- name: Publish to NuGet | |
run: dotnet nuget push ./dist/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} |