Skip to content

ci: publish to NuGet with trusted publishing - #11

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

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

Conversation

@brunobritodev

Copy link
Copy Markdown
Member

Why

The org NuGet API key (NUGET_AUTH_TOKEN) expired, so the last releases were tagged on GitHub but failed to push with 403 The specified API key has expired.

What changes

  • Trusted publishing (OIDC): NuGet/login@v1 exchanges the GitHub OIDC token for a short-lived nuget.org key. There's no long-lived secret to expire anymore.
    • The policy on nuget.org is owned by desenvolvedor.io and bound to this repository and workflow file.
    • NUGET_USER is an org-level Actions variable.
    • permissions gains id-token: write.
  • Re-publish an existing release: a new workflow_dispatch input version checks out tag v<version>, builds, tests, packs and pushes it, skipping semantic-release.
    • Re-running a failed job doesn't work, because semantic-release finds the existing tag and skips the push.
    • The version is passed through env and validated as semver, so the input isn't interpolated into the script.
  • Pack and push only run when there is a version, with --skip-duplicate.

After merging

The merge commit is ci:, so it releases nothing by itself. Once it's merged, NUGET_AUTH_TOKEN can be removed from the org.

nuget.org API keys expire and the org key already did, which made the
last releases fail with 403. Publish with NuGet/login (OIDC) instead:
the job gets a short-lived key from the trusted publishing policy for
this repository and workflow file.

Also adds a workflow_dispatch input to publish an existing release tag
again, since re-running the job skips the push once the release exists.
@brunobritodev
brunobritodev merged commit 152129c into master Nov 18, 2026
2 checks passed
@brunobritodev
brunobritodev deleted the ci/nuget-trusted-publishing branch November 18, 2026 00:55
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant