ci: publish Utxorpc.Spec via NuGet trusted publishing - #212
Merged
Conversation
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.
Migrates the dotnet codegen publish from a long-lived nuget.org API key to trusted publishing (OIDC), matching what
publish-nodealready does for npm in this same workflow.Changes
.github/workflows/publish-all.yml—publish-dotnetgains the same permissions blockpublish-nodealready carries:and passes
user: ${{ vars.NUGET_USER }}in place ofregistry-token: ${{ secrets.NUGET_REGISTRY_TOKEN }}..github/actions/publish-dotnet/action.yml— swaps theregistry-tokeninput foruser, adds aNuGet/login@v1step, and pushes withsteps.login.outputs.NUGET_API_KEY.After this,
NUGET_REGISTRY_TOKENis referenced nowhere in the repo.Details that shaped the diff
The login step is gated on
mode == 'release'. A token exchange is a live call to nuget.org, and since #211 dry-runs deliberately don't contact live registries. Noterelease.ymlinvokespublish-alltwice — once asdry-run, then asrelease— so an ungated login would fire on the dry-run pass of every release.The exchange sits immediately before the push. NuGet's issued keys are valid for one hour and single-use (one OIDC token → one API key), so requesting one earlier in the job risks expiry on a slow pack.
NUGET_USERis a variable, not a secret. It holds the nuget.org profile name (TxPipe), which nuget.org already publishes as the owner ofUtxorpc.Spec— so a secret buys no confidentiality while costing verifiability. A wrong value in a variable can be read and checked; in a secret it surfaces only as a failed release.The permissions propagate.
release.ymlsets no caller-levelpermissions, so it's fair to ask whether a job inside a called workflow can requestid-token: write. It can, and this repo already proves it:@utxorpc/spec@0.19.2carries SLSA provenance attestations, which are only produced when npm's OIDC path succeeded frompublish-nodeunder exactly this structure.A trusted publishing policy binds to repository owner + repository + workflow file. For a reusable workflow the OIDC token carries two distinct claims —
workflow_ref(the entry workflow,release.yml) andjob_workflow_ref(the workflow defining the job,publish-all.yml) — and which one nuget.org validates determines what the policy must name.I have not been able to establish which from the documentation, and getting it wrong fails the exchange at publish time. The reliable check is the npm trusted publisher already configured for this repo: whatever workflow file that policy names is the claim GitHub is presenting, and the NuGet policy should match it.
Related
utxorpc/dotnet-sdkalready publishesUtxorpc.Sdkthis way (dotnet-sdk#39), verified end-to-end onv1.8.0-alpha.NUGET_REGISTRY_TOKEN. It needs amending alongside this; the parity matrix currently marks dotnet-sdk ❌ on "auth = spec" precisely because the SDK moved ahead of this repo.NUGET_REGISTRY_TOKENcan be revoked on nuget.org and deleted from this repo's secrets.🤖 Generated with Claude Code