Repository navigation
ci(nuget): publish with nuget trusted publishing - #194
Draft
AndreaCuneo wants to merge 1 commit into
Draft
AndreaCuneo wants to merge 1 commit into
AndreaCuneo wants to merge 1 commit into
Conversation
A separate job in the 'nuget' environment exchanges a GitHub OIDC token for a one-hour NuGet API key, so no long-lived key is stored. Only that job can request the token: the pack job uploads the packages as an artifact. The actions of that job are pinned to commits.
Code coverage overviewLanguages: C# C# / code-coverage/net10.0
C# / code-coverage/net8.0
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
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.
Summary
Moves NuGet publishing to NuGet trusted publishing, as done in ARKlab/Ark.Tools#1294: no long-lived API key is stored, and a key cannot expire in the middle of a release.
.github/workflows/publish_nuget.yml:deployjob (now named Pack, still on Windows) packs as before but no longer pushes: it uploads the output folder as the artifactpackages.publish,needs: deploy, Ubuntu): the only job withid-token: write. It runs in the GitHub environmentnuget, downloads the packages, exchanges the OIDC token for a one-hour NuGet key (NuGet/login) and pushesoutput/*.nupkg(the.snupkgsymbol packages go with them, as before). It runs no repository code. Its actions are pinned to commits, and the key reaches the push throughenv.--skip-duplicateis added, so a re-run after a partial push does not fail on packages already on nuget.org.deployruns only onv*tag pushes.Setup needed before the next release tag
nuget. No required reviewers. Deployment branches and tags → Selected branches and tags → add a rule of type Tag with patternv*. Create it before the next tag: if it does not exist, GitHub creates it on the first run without the tag rule.NUGET_USER(the nuget.org user name that creates the policy) as an environment secret ofnugetor as a repository secret.Ark_Lab, repository ownerARKlab, repositoryMessagePack, workflow filepublish_nuget.yml, environmentnuget. If the form offers a package scope, set it toMessagePack.NodaTime.NUGET_AUTH_TOKENsecret and revoke its key on nuget.org.If only the push fails, re-run the Push to NuGet job alone: the packages stay in the artifact.
Known limits, not changed here
battila7/get-version-action@v2. It cannot get the key, but it builds what is published.Verification
contents: read; Push to NuGet onlyid-token: write.${{ github.workspace }}\outputand the Ubuntu download tooutput;SymbolPackageFormatissnupkg, so*.nupkgmatches only the main package.git ls-remote).Generated by Claude Code