Repository navigation
Switch NuGet release publishing from API key to OIDC trusted publishing - #568
Merged
Merged
Conversation
Replaces the long-lived NUGET_API_KEY secret with GitHub OIDC token exchange via NuGet/login@v1, keeping --skip-duplicate so a job retry after a partial failure doesn't fail on the already-published version.
Matches the Environment field on the nuget.org Trusted Publishing policy, so the OIDC token carries the environment claim it expects.
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.
Replaces the long-lived NUGET_API_KEY secret with GitHub OIDC token exchange via NuGet/login@v1, keeping --skip-duplicate so a job retry after a partial failure doesn't fail on the already-published version.
Note
Medium Risk
Changes how release packages authenticate to nuget.org; misconfigured OIDC, environment, or secrets would block or mis-route publishes.
Overview
The NuGet release workflow now publishes with GitHub OIDC instead of a stored
NUGET_API_KEY.The job is bound to the
releaseenvironment and grantsid-token: write(pluscontents: read) soNuGet/login@v1can exchange an OIDC token for a short-lived push key usingsecrets.NUGET_USER. Publishing is done withdotnet nuget pushon the packed.nupkgfiles, replacingalirezanet/publish-nuget.--skip-duplicateis unchanged so retries after a partial publish do not fail.Reviewed by Cursor Bugbot for commit 3378014. Bugbot is set up for automated code reviews on this repo. Configure here.