diff --git a/.github/workflows/Harp.Generators.yml b/.github/workflows/Harp.Generators.yml index 3a30a07..4cd4e6b 100644 --- a/.github/workflows/Harp.Generators.yml +++ b/.github/workflows/Harp.Generators.yml @@ -242,6 +242,9 @@ jobs: environment: public-release needs: build if: github.event_name == 'release' + permissions: + # Needed to request the OIDC token for NuGet.org trusted publishing + id-token: write steps: # ----------------------------------------------------------------------- Set up .NET - name: Setup .NET @@ -257,8 +260,14 @@ jobs: path: artifacts/packages/ # ----------------------------------------------------------------------- Push to NuGet.org + - name: Log in to NuGet.org with OIDC + uses: NuGet/login@v1 + id: nuget-login + with: + user: ${{secrets.NUGET_USER}} + - name: Push to NuGet.org - run: dotnet nuget push "artifacts/packages/*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source ${{vars.NUGET_API_URL}} + run: dotnet nuget push "artifacts/packages/*.nupkg" --api-key ${{steps.nuget-login.outputs.NUGET_API_KEY}} --source ${{vars.NUGET_API_URL}} env: # This is a workaround for https://github.com/NuGet/Home/issues/9775 DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0