Publish UUIDNext to NuGet #12
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: Publish UUIDNext to NuGet | |
| on: workflow_dispatch | |
| defaults: | |
| run: | |
| working-directory: Src | |
| permissions: | |
| id-token: write # required for Nuget Trusted Publishing | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # enable GitHub OIDC (OpenID Connect standard) token issuance for this job | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build -c Release --no-restore | |
| - name: Test | |
| run: dotnet test -c Release --no-build --framework net8.0 | |
| - name: Pack nugets | |
| run: dotnet pack "./UUIDNext/UUIDNext.csproj" -c Release --no-build --output . | |
| # 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 }} | |
| - name: Push to NuGet | |
| run: dotnet nuget push "UUIDNext.*.nupkg" --api-key ${{steps.login.outputs.NUGET_API_KEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json |