Skip to content

chore: Publish to nuget.org with trusted publishing - #90

Merged
JacobAtchley merged 1 commit into
mainfrom
forks/mcarey/nuget-trusted-publishing
Nov 6, 2026
Merged

JacobAtchley merged 1 commit into
mainfrom
forks/mcarey/nuget-trusted-publishing

Conversation

@mcarey1590

@mcarey1590 mcarey1590 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What changed

dotnet-release.yml now publishes with nuget.org trusted publishing instead of the long-lived FIREBEND_NUGET_KEY secret:

  • release job gets permissions: contents: read, id-token: write (checkout and the version push still use the PAT)
  • new NuGet/login@v1 step exchanges the GitHub OIDC token for a one-hour NuGet API key
  • dotnet nuget push uses steps.nuget-login.outputs.NUGET_API_KEY

Why

The shared NuGet API key expired (jobba release run 42282909910 failed with 403 The specified API key has expired). Trusted publishing removes the stored key, so there is nothing to rotate or leak.

Prerequisites (before merge)

  • nuget.org trusted publishing policy: owner Firebend, repo firebend/json-patch-generator, workflow dotnet-release.yml, packages Firebend.JsonPatchGenerator
  • org variable NUGET_USER = MarcusCarey (nuget.org username of the policy creator)

How to test

The workflow only runs on push to main, so the first release after merge is the test: the NuGet login step succeeds and Publish pushes the packages. chore: is insignificant to versionize, so this PR alone does not cut a release.

After a successful publish: delete the FIREBEND_NUGET_KEY secret and revoke the expired key on nuget.org.

Same change in jobba, auto-crud, lit-redis, json-patch-generator.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YUXrZTZXQWDbUQnK4Fx47r

Swap the long-lived NuGet API key secret for nuget.org trusted publishing:
the release job gets an OIDC token (id-token: write), NuGet/login exchanges
it for a one-hour API key, and dotnet nuget push uses that key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YUXrZTZXQWDbUQnK4Fx47r
@mcarey1590
mcarey1590 marked this pull request as ready for review November 6, 2026 21:18
Copilot AI balanced review requested due to automatic review settings November 6, 2026 21:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the migration to NuGet trusted publishing.

No open issues 🎉

What changed in this PR

Migrates the NuGet release workflow from a long-lived API key to nuget.org trusted publishing, removing the need to rotate a stored publishing credential.

Changes:

  • Grants the release job read access to repository contents and permission to request an OIDC token.
  • Adds NuGet/login@v1, using vars.NUGET_USER to obtain a short-lived API key.
  • Uses that key for package publishing while preserving the existing versionize success condition.
File Description
.github/​workflows/​dotnet-release.yml Adds trusted publishing authentication and replaces the stored NuGet API key.

Review effort: Balanced

@JacobAtchley
JacobAtchley merged commit 7ea71c1 into main Nov 6, 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.

3 participants