Switch NuGet publish to trusted publishing (OIDC)#39
Merged
Conversation
Replace API key secret with GitHub OIDC trusted publishing. Adds id-token: write permission so the runner can obtain an OIDC token that NuGet validates against the configured trusted publisher policy, removing the need for a stored NUGET_PUBLISH_KEY secret. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the GitHub Actions NuGet publishing workflow to use NuGet.org trusted publishing via GitHub OIDC instead of a long-lived NUGET_PUBLISH_KEY secret.
Changes:
- Adds
id-token: writeandcontents: readjob permissions to enable OIDC token issuance. - Removes the
NUGET_PUBLISH_KEYsecret usage and the--api-keyflag fromdotnet nuget push.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Move NuGet push into a dedicated publish job with needs: build so id-token: write is never granted during PR builds - Fetch the OIDC token (audience api.nuget.org) via actions/github-script and pass it as --api-key so the push authenticates correctly - Pass packages between jobs via upload/download-artifact@v4 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
id-token: writepermission to the job so GitHub Actions can issue an OIDC tokenNUGET_API_KEYsecret and--api-keyflag from the push stepdotnet.yml/roodfluweel/paynl-csharp-sdk)Test plan
main(or push arelease/v*tag) and confirm the Push Nuget step completes without an API key secretNUGET_PUBLISH_KEYsecret from repo settings once a successful publish is confirmed🤖 Generated with Claude Code