Use NuGet trusted publishing (OIDC) instead of a long-lived API key - #389
Open
zidad wants to merge 1 commit into
Open
Use NuGet trusted publishing (OIDC) instead of a long-lived API key#389zidad wants to merge 1 commit into
zidad wants to merge 1 commit into
Conversation
Exchange the GitHub Actions OIDC token for a short-lived nuget.org API key via NuGet/login, scoped to the EasyNetQ organization. Removes the need for the NUGET_TOKEN secret. The publish job now runs in the 'release' environment so the trusted publishing policy can be pinned to it.
zidad
requested review from
Pliner,
luigiberrettini and
micdenny
as code owners
August 5, 2026 15:52
|
Kilo Code Review could not run — your account is out of credits. Add credits or switch to a free model to enable reviews on this change. |
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.
Switches NuGet publishing from the long-lived
NUGET_TOKENsecret to trusted publishing (OIDC).The
publish-to-nugetjob now exchanges the GitHub Actions OIDC token for a short-lived (1 hour) nuget.org API key viaNuGet/login@v1, scoped to the EasyNetQ organization account rather than an individual profile.Changes
id-token: writepermission on the publish job so GitHub issues the OIDC tokenenvironment: releaseso the trusted publishing policy can be pinned to it, and so a manual approval gate can be added laterNuGet/login@v1step withuser: EasyNetQ(must match the policy's package owner)dotnet nuget pushusessteps.nuget-login.outputs.NUGET_API_KEYinstead ofsecrets.NUGET_TOKENRequired setup before merging
On nuget.org (signed in as an EasyNetQ org member) — username menu -> Trusted Publishing -> add a policy:
EasyNetQ(the organization, not a personal account)EasyNetQEasyNetQ.Management.Clientci.ymlreleaseOn GitHub — done: the
releaseenvironment has been created (no protection rules). Optionally add required reviewers or a tag-only deployment branch rule for a manual gate before publish.Keep
NUGET_TOKENuntil the first tagged release publishes successfully, then delete the secret.Notes