diff --git a/.github/workflows/dotnet-release.yml b/.github/workflows/dotnet-release.yml index 3260af3..44c3917 100644 --- a/.github/workflows/dotnet-release.yml +++ b/.github/workflows/dotnet-release.yml @@ -9,6 +9,9 @@ jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # nuget.org trusted publishing (OIDC) steps: - name: Setup Git @@ -57,9 +60,16 @@ jobs: if: steps.versionize.outcome == 'success' run : dotnet pack **/*/JsonPatchGenerator.csproj --configuration Release -o out/pack + - name: NuGet login (trusted publishing) + id: nuget-login + if: steps.versionize.outcome == 'success' + uses: NuGet/login@v1 + with: + user: ${{ vars.NUGET_USER }} + - name: Publish if: steps.versionize.outcome == 'success' - run: dotnet nuget push ./out/pack/*.nupkg --api-key ${{secrets.FIREBEND_NUGET_KEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + run: dotnet nuget push ./out/pack/*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --skip-duplicate --source https://api.nuget.org/v3/index.json - name: Push version changes if: steps.versionize.outcome == 'success'