Skip to content

Switch NuGet release publishing from API key to OIDC trusted publishing - #568

Merged
mgravell merged 3 commits into
masterfrom
marc/nuget-oidc-publish
Sep 18, 2026
Merged

mgravell merged 3 commits into
masterfrom
marc/nuget-oidc-publish

Conversation

@mgravell

@mgravell mgravell commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

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 release environment and grants id-token: write (plus contents: read) so NuGet/login@v1 can exchange an OIDC token for a short-lived push key using secrets.NUGET_USER. Publishing is done with dotnet nuget push on the packed .nupkg files, replacing alirezanet/publish-nuget. --skip-duplicate is 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.

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.
@mgravell
mgravell merged commit 2f98c14 into master Sep 18, 2026
22 checks passed
@mgravell
mgravell deleted the marc/nuget-oidc-publish branch September 18, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant