Skip to content

Publish NuGet packages through trusted publishing - #5340

Merged
jeremydmiller merged 1 commit into
mainfrom
nuget-trusted-publishing
Nov 2, 2026
Merged

jeremydmiller merged 1 commit into
mainfrom
nuget-trusted-publishing

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

publish_nugets.yml now authenticates to nuget.org with trusted publishing instead of the long-lived NUGET_API_KEY secret.

  • New NuGet/login@v1 step (user: jeremydmiller) trades the run's GitHub OIDC token for a short-lived API key under the trusted publishing policy already configured on nuget.org for this repository and this workflow file.
  • The job declares permissions: contents: read, id-token: write; id-token: write is what lets the runner request the OIDC token.
  • The push step reads the key from steps.nuget_login.outputs.NUGET_API_KEY through an env var.

Same shape as JasperFx's on-manual-do-nuget-publish.yml. The policy names the workflow file, so renaming publish_nugets.yml breaks it until the policy is edited on nuget.org.

Not touched: dotnet.yml's "Publish Release Packages" step still references NUGET_API_KEY, but it only runs on refs/tags/v* and that workflow never triggers on tags, so it is dead code.

This can only be proven by the real run, i.e. the 6.61.0 publish.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DCggXgxnG3EBXoR9rrq37U

publish_nugets.yml now gets its nuget.org key from NuGet/login, which trades
the run's GitHub OIDC token for a short-lived API key under the trusted
publishing policy already set up on nuget.org, instead of the long-lived
NUGET_API_KEY secret. Same shape as JasperFx's manual publish workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCggXgxnG3EBXoR9rrq37U
@jeremydmiller
jeremydmiller merged commit 85c709d into main Nov 2, 2026
46 checks passed
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