Skip to content

NuGet publish: trusted publishing and manual re-publish of a release tag - #149

Merged
HadenSmith merged 2 commits into
mainfrom
haden/nuget-trusted-publishing
Nov 11, 2026
Merged

HadenSmith merged 2 commits into
mainfrom
haden/nuget-trusted-publishing

Conversation

@HadenSmith

@HadenSmith HadenSmith commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The v2.3.0 NuGet publish failed with a 403: the stored NUGET_ORG_API_KEY has expired. This switches NuGetPublish.yml to nuget.org trusted publishing and makes it possible to publish an existing release tag again.

  • The job requests a GitHub OIDC token (id-token: write) and exchanges it through NuGet/login@v1 for a one-hour nuget.org API key; no long-lived key is stored.
  • New workflow_dispatch input release_tag: a manual run checks out that tag and publishes it, so v2.3.0 can be published from main without moving the tag.
  • The workflow name stays "Publish to NuGet.org", which PythonPublish.yml matches for its automatic chain.

One-time setup

  • nuget.org, signed in as an owner of RMC.Numerics: Trusted Publishing policy (done) with Package Owner USACE-RMC, Repository Owner USACE-RMC, Repository Numerics, Workflow File NuGetPublish.yml, package RMC.Numerics, no environment.
  • The login user is the nuget.org profile USACE-RMC, as in the other RMC package workflows; no secret is needed.

Publishing v2.3.0 after merge

  1. gh workflow run NuGetPublish.yml -R USACE-RMC/Numerics --ref main -f release_tag=v2.3.0
  2. When it succeeds: gh workflow run PythonPublish.yml -R USACE-RMC/Numerics --ref main -f release_tag=v2.3.0 -f publish_to_pypi=true, then approve the pypi environment. The automatic PyPI chain only follows NuGet runs started by a Release event.

The NUGET_ORG_API_KEY secret can be deleted once this is in use.

🤖 Generated with Claude Code

…of a stored API key, and a manual run that publishes an existing release tag
@HadenSmith
HadenSmith merged commit 331fd34 into main Nov 11, 2026
1 check passed
@HadenSmith
HadenSmith deleted the haden/nuget-trusted-publishing branch November 11, 2026 18:00
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