ci(release): enhance release workflow with GitHub Packages, symbols, … #3
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 & Publish | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 6.0.x | |
| 8.0.x | |
| 9.0.x | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Extract version | |
| id: ver | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT | |
| - name: Pack | |
| run: | | |
| dotnet pack src/HttpClient.Resilience/HttpClient.Resilience.csproj \ | |
| -c Release \ | |
| -p:ContinuousIntegrationBuild=true \ | |
| -p:Version=${{ steps.ver.outputs.version }} \ | |
| --no-build | |
| - name: Archive package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nupkg | |
| path: src/HttpClient.Resilience/bin/Release/*.nupkg | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| files: src/HttpClient.Resilience/bin/Release/*.nupkg | |
| generate_release_notes: true | |
| - name: Publish to NuGet | |
| run: | | |
| dotnet nuget push src/HttpClient.Resilience/bin/Release/*.nupkg \ | |
| --api-key ${{ secrets.NUGET_API_KEY }} \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate | |
| - name: Publish symbols to NuGet | |
| run: dotnet nuget push src/HttpClient.Resilience/bin/Release/*.snupkg \ | |
| --api-key ${{ secrets.NUGET_API_KEY }} \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate | |
| - name: Publish to GitHub Packages | |
| run: | | |
| dotnet nuget push src/HttpClient.Resilience/bin/Release/*.nupkg \ | |
| --api-key ${{ secrets.GITHUB_TOKEN }} \ | |
| --source https://nuget.pkg.github.com/akrisanov/index.json \ | |
| --skip-duplicate |