Skip to content

ci: publish to nuget.org with trusted publishing - #38

Merged
michaelstonis merged 1 commit into
mainfrom
ci/nuget-trusted-publishing
Dec 1, 2026
Merged

michaelstonis merged 1 commit into
mainfrom
ci/nuget-trusted-publishing

Conversation

@michaelstonis

Copy link
Copy Markdown
Contributor

Summary

  • Replace the EIGHTBOT_NUGET_APIKEY secret with NuGet trusted publishing: NuGet/login@v1 exchanges the workflow's OIDC token for a short-lived (1 hour) nuget.org API key, used by all five nuget.org pushes.
  • The build job now declares id-token: write. Because an explicit permissions block sets everything unlisted to none, it also declares packages: write (GitHub Packages pushes) and contents: read (checkout).
  • GitHub Packages pushes are unchanged and still use GITHUB_TOKEN.

Setup (done)

  • nuget.org trusted publishing policy for TheEightBot/TychoDB, workflow nuget.yml, no environment, under the Eight-Bot account.
  • Repo Actions variable NUGET_USER = Eight-Bot.

After the first successful tag release

  • Delete the EIGHTBOT_NUGET_APIKEY repo secret and revoke the key on nuget.org.

Notes

  • This workflow only runs on v* tags, so the change isn't exercised until the next release.
  • The short-lived key is requested right before the first nuget.org push; the remaining builds and pushes would have to take over an hour for it to expire.

Replace the long-lived EIGHTBOT_NUGET_APIKEY secret with NuGet/login,
which exchanges the workflow's OIDC token for a short-lived API key.
The build job now declares id-token: write, plus packages: write and
contents: read since an explicit permissions block drops the rest.
@michaelstonis
michaelstonis merged commit ce9ecd5 into main Dec 1, 2026
2 checks passed
@michaelstonis
michaelstonis deleted the ci/nuget-trusted-publishing branch December 1, 2026 15:41
@michaelstonis michaelstonis mentioned this pull request Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant