ci: publish via NuGet Trusted Publishing (keyless OIDC) - #2
Merged
Conversation
Replace the long-lived NUGET_API_KEY secret with NuGet.org Trusted Publishing per the official docs. The publish job now requests a GitHub OIDC token (id-token: write) and NuGet/login@v1 exchanges it for a short-lived (1 h) API key used by dotnet nuget push. The only secret needed is NUGET_USER (the nuget.org profile name). The old "Require NUGET_API_KEY secret" guard is replaced by a NUGET_USER guard, and the header comment's outdated "not GA / not supported" rationale is removed. All other behavior (master gate, version resolution, tag check, pack, dry_run, tag + GitHub release) is preserved. CHANGELOG updated.
Pijukatel
force-pushed
the
claude/fervent-allen-bp8pcw
branch
from
July 7, 2026 09:36
d5e23bb to
435042d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Converts the manual NuGet publish workflow (
.github/workflows/dotnet-publish.yml) from a long-livedNUGET_API_KEYsecret to NuGet.org Trusted Publishing (keyless OIDC).Changes
id-token: write(keptcontents: writefor the tagged release); permissions moved to thepublishjob scope.NUGET_API_KEYsecret flow with aNuGet/login@v1step (user: ${{ secrets.NUGET_USER }}) that exchanges the GitHub OIDC token for a short-lived (1 h) key. The step runs immediately before the push so the key does not expire.dotnet nuget push ... --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json(kept--skip-duplicate).All other behavior is preserved:
workflow_dispatch-only trigger,dry_runinput, concurrency group, master-branch gate, .NET setup, restore/format/build/unit-test gates, version resolution from csproj, tag-existence check, pack, tag creation, and GitHub release.Operator prerequisite (before first release)
A Trusted Publishing policy must be registered on nuget.org for this repo/workflow (Workflow File =
dotnet-publish.yml) and theNUGET_USERrepo secret set to the nuget.org profile name (not an email). Both are enforced at run time (guard + login step), so a misconfigured release fails fast.Scope
Targeted change to the publish workflow only. The client is already synced to spec
v2-2026-07-02T131926Z; no endpoint/test/doc regeneration. No sibling-client changes — Trusted Publishing is nuget.org-specific.