Update versioning system (#2) #2
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
| # This workflow will build a .NET project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
| name: Publish Package to NuGet | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| permissions: | |
| id-token: write # enable GitHub OIDC token issuance for this job | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get version info | |
| uses: dotnet/nbgv@master | |
| id: nbgv | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: "9.0.x" | |
| - name: Pack NuGet (Release) | |
| run: | | |
| dotnet pack Collections.Pooled/Collections.Pooled.csproj \ | |
| -c Release \ | |
| -p:ContinuousIntegrationBuild=true \ | |
| -p:Version=${{ steps.nbgv.outputs.NuGetPackageVersion }} \ | |
| -p:AssemblyVersion=${{ steps.nbgv.outputs.AssemblyVersion }} \ | |
| -p:FileVersion=${{ steps.nbgv.outputs.AssemblyFileVersion }} \ | |
| -o artifacts | |
| # Get a short-lived NuGet API key | |
| - name: NuGet login (OIDC → temp API key) | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| # Push the package | |
| - name: NuGet Push | |
| run: dotnet nuget push artifacts/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json |