Skip to content

Publish to nuget.org through trusted publishing instead of an API key - #45

Merged
Mpdreamz merged 1 commit into
masterfrom
ci/nuget-trusted-publishing
Nov 1, 2026
Merged

Mpdreamz merged 1 commit into
masterfrom
ci/nuget-trusted-publishing

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

The org-wide NUGET_ORG_API_KEY secret has expired, so tagged releases can no longer push to nuget.org. This switches the push to NuGet trusted publishing: NuGet/login exchanges the workflow's GitHub OIDC token for a nuget.org API key that lives for an hour, so there is no long-lived key left to expire or rotate. Same change as nullean/curb#193.

Change (.github/workflows/ci.yml, job build)

  • id-token: write added to the job's permissions, so it can request an OIDC token.
  • A NuGet/login@v1 step (id nuget-login, user: ${{ secrets.NUGET_USER }}) placed immediately before the nuget.org push, with the same tag-only condition as the push.
  • The push uses ${{ steps.nuget-login.outputs.NUGET_API_KEY }} instead of secrets.NUGET_ORG_API_KEY. --skip-duplicate is kept. The GitHub Packages canary push (GITHUB_TOKEN) is unchanged.

Prerequisites before the next release

  1. A trusted-publishing policy on nuget.org owned by the nullean organization: repository assembly-differ, workflow ci.yml, no environment.
  2. An org secret NUGET_USER holding the nuget.org profile name (Mpdreamz).

Testing

Validated with actionlint and a YAML parse. PR CI does not run the publish steps (they only run on tag pushes), so this can only be proven by the next tagged release.

🤖 Generated with Claude Code

The org-wide NUGET_ORG_API_KEY secret expired, so tagged releases could no
longer push. NuGet/login now exchanges the workflow's OIDC token for a
short-lived key under a nuget.org trusted-publishing policy for this
repository's ci.yml, leaving no long-lived key to rotate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Mpdreamz
Mpdreamz merged commit 64701b0 into master Nov 1, 2026
2 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