Skip to content

Publish to NuGet through trusted publishing - #40

Merged
jonathan-kosgei merged 1 commit into
masterfrom
trusted-publishing
Nov 3, 2026
Merged

jonathan-kosgei merged 1 commit into
masterfrom
trusted-publishing

Conversation

@jonathan-kosgei

@jonathan-kosgei jonathan-kosgei commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The publish job in publish.yml exchanges its OpenID Connect token for a short-lived NuGet API key with NuGet/login, through the trusted publishing policy of the nuget.org user ipdata that owns the package. The NUGET_API_KEY secret is no longer referenced and can be deleted. A workflow_dispatch input allows publishing an existing tag on demand.

How it works

  • The job gains id-token: write; NuGet/login@v1 returns NUGET_API_KEY as a step output, which dotnet nuget push uses in place of the stored key.
  • Build, test and pack steps are unchanged.
  • gh workflow run publish.yml -f tag=v3.1.0 publishes a tag that already exists, which the automatic release path skips.

Verification

  • YAML parses; actionlint reports no findings; CRLF line endings of the file are preserved.

🤖 Generated with Claude Code

The publish job exchanges its OpenID Connect token for a short-lived API
key with NuGet/login, using the trusted publishing policy of the nuget.org
user that owns the package, so the NUGET_API_KEY secret is no longer
used. A workflow_dispatch input allows publishing an existing tag on
demand.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jonathan-kosgei
jonathan-kosgei merged commit 2b2e7b4 into master Nov 3, 2026
1 check 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.

2 participants