Release #1
Workflow file for this run
This file contains hidden or 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: Release | |
| # Publishes both packages (and symbol packages) to NuGet when a GitHub Release is published. | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| id-token: write # required for NuGet Trusted Publishing (OIDC) | |
| jobs: | |
| publish: | |
| name: Pack & publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| - name: Derive version from tag | |
| id: version | |
| run: echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Verify formatting | |
| run: dotnet format --verify-no-changes --severity warn | |
| - name: Build | |
| run: dotnet build -c Release --no-restore -p:Version=${{ steps.version.outputs.value }} -p:ContinuousIntegrationBuild=true | |
| - name: Test | |
| run: dotnet test -c Release --no-build | |
| - name: Pack | |
| run: | | |
| dotnet pack src/TestingBot.Api/TestingBot.Api.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.value }} -o ./artifacts | |
| dotnet pack src/TestingBot.Api.DependencyInjection/TestingBot.Api.DependencyInjection.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.value }} -o ./artifacts | |
| - name: NuGet login (Trusted Publishing) | |
| id: login | |
| uses: NuGet/login@v1 | |
| with: | |
| user: testingbot | |
| - name: Push to NuGet | |
| run: dotnet nuget push "./artifacts/*.nupkg" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| - name: Upload packages | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: packages | |
| path: ./artifacts/*.*nupkg |