Skip to content

Use NuGet Trusted Publishing (OIDC) instead of API key#5

Merged
PFalkowski merged 1 commit into
masterfrom
ci/trusted-publishing
Jun 13, 2026
Merged

Use NuGet Trusted Publishing (OIDC) instead of API key#5
PFalkowski merged 1 commit into
masterfrom
ci/trusted-publishing

Conversation

@PFalkowski

Copy link
Copy Markdown
Owner

NuGet.org now discourages long-lived API keys in favor of Trusted Publishing. This switches the publish workflow to OIDC.

Changes

  • Grant the publish job id-token: write (required to mint the GitHub OIDC token).
  • Add a NuGet/login@v1 step that exchanges the OIDC token for a short-lived API key.
  • Push using that short-lived key; the secrets.NUGET_API_KEY reference is removed entirely.
  • The NuGet account name comes from the NUGET_USER repo variable (not a secret — it's just a username).

Required setup (one-time)

  • Set the repo variable: gh variable set NUGET_USER --body <your-nuget-username>
  • Ensure the NuGet.org Trusted Publishing policy points at owner PFalkowski, repo Extensions.Standard, workflow publish.yml.
  • Any previously-created NUGET_API_KEY secret is no longer used and can be deleted.

No long-lived credentials remain in the pipeline.

🤖 Generated with Claude Code

Replace the long-lived NUGET_API_KEY secret with NuGet Trusted
Publishing: grant the job id-token: write, exchange the GitHub OIDC
token for a short-lived key via NuGet/login@v1, and push with that.
The NuGet account username is read from the NUGET_USER repo variable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@PFalkowski PFalkowski merged commit 45e677c into master Jun 13, 2026
1 check 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