Repository navigation
Publish to nuget.org again, via Trusted Publishing - #21
Merged
Merged
Conversation
The guide was written before any release had pushed to GHCR and said so. 10.2.0 is out, the package is public, and an anonymous `docker pull` of ghcr.io/timmoth/fortitude:v10.2.0 works — verified by pulling it and checking the health endpoint answers.
GitHub Packages requires authentication even for a public package, so every consumer needed a classic token and a configured feed just to install a testing library. That cost outweighed what the move bought. The release workflow pushes to nuget.org without a stored API key. The job mints a GitHub OIDC token, NuGet/login exchanges it for a key valid for one hour, and that key does the push. The exchange step sits immediately before the push because each token buys exactly one key and the key expires. This depends on a Trusted Publishing policy configured on nuget.org naming the repository owner, the repository and release.yml, owned by the account that owns the package. CONTRIBUTING.md spells the fields out. The only repository secret is NUGET_USER, the nuget.org profile name. Symbol packages go back to .snupkg, which nuget.org's symbol server accepts; they had been embedded in the assembly because GHCR has none. Installing is plain `dotnet add package Fortitude` again, so the installation guide loses the token, the nuget.config and the per-tool feed setup that only existed to work around the GitHub Packages requirement. The image stays on GHCR, which has no such problem.
The nuget.org profile name is public and authorises nothing on its own - the Trusted Publishing policy on nuget.org is what permits the push. Holding it as a repository secret implied otherwise and left a release failing for a missing value that was never confidential. The repository now needs no secrets at all. Also restores the README's install block to the shape it had before the move off nuget.org, and marks the 10.2.0 changelog entry as superseded so a reader of those notes is not told to authenticate to a feed that is no longer used.
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.
GitHub Packages requires authentication even for a public package, so every consumer
needed a classic token and a configured feed just to install a testing library. This moves
publishing back to nuget.org, keyless.
How it works
The release job mints a GitHub OIDC token,
NuGet/login@v1exchanges it for an API key valid for one hour, and that key does the push. No API key is
stored anywhere. The exchange step sits immediately before the push, because each OIDC token
buys exactly one key and an early request only risks it expiring behind a slow build.
The repository needs no secrets at all. The container image is unaffected and stays on
ghcr.io/timmoth/fortitude.The policy lives on nuget.org, not in this repository. Under your username → Trusted
Publishing, add a policy with:
TimmothFortituderelease.yml— the file name alone, no.github/workflows/pathIt must be owned by
aptacode, the account that owns the package on nuget.org, and scopedto allow publishing new versions of
Fortitude.CONTRIBUTING.mdcarries all of this,including the note that a policy on a private repo starts temporarily active for 7 days and
turns permanent on the first successful publish.
Docs are back to how they were
original shape — the
Fortitude on NuGetlink and# Install via the .NET CLI:commentincluded. The GHCR image badge stays, since the image did not move back.
nuget.configand the per-tool feed setup forVS / VS Code / Rider — all of which existed only to work around GitHub Packages. Installing
is
dotnet add package Fortitude. There is a short note for teams behind a private mirrorbut no walkthrough; say the word if you want that material kept.
10.1.4and10.2.0live on GitHub Packages rather than nuget.org, sonobody goes looking in the wrong place, and the
10.2.0changelog entry is markedsuperseded so its "authenticate to the feed" instruction does not mislead.
Also
Symbols return to
.snupkg, which nuget.org's symbol server accepts — they had beenembedded in the assembly because GHCR has no symbol server.
dotnet packnow emitsFortitude.10.2.0.nupkgandFortitude.10.2.0.snupkg; verified locally.State of play
nuget.org currently has up to
10.1.2(owneraptacode).10.2.0went to GitHubPackages, so the next release here is a new version of an existing package, not a new
package — worth knowing when picking the policy scope.
Carried over from the first commit on this branch
The installation guide had said the GHCR image was not published yet. 10.2.0 is out, and I
verified it: pulled
ghcr.io/timmoth/fortitude:v10.2.0anonymously with nodocker login,ran it,
/fortitude/healthansweredserver runningas UID 1654, and bothlinux/amd64andlinux/arm64are in the manifest.Build is clean (0 warnings, warnings-as-errors) and all 506 tests pass.