ci: make the NuGet publish actually work, via Trusted Publishing#184
Open
phmatray wants to merge 1 commit into
Open
ci: make the NuGet publish actually work, via Trusted Publishing#184phmatray wants to merge 1 commit into
phmatray wants to merge 1 commit into
Conversation
This job held a live NUGET_API_KEY secret while being incapable of publishing
anything. Four faults, all on the same path:
- it never packed. The job checked out, computed a version, installed the SDK,
then pushed packages that did not exist — the build/test jobs run on separate
runners and nothing carried their output over;
- it invoked 'nuget push', the nuget.exe CLI, which is not present on
ubuntu-latest;
- the glob was Windows-shaped ('**\*.nupkg');
- BUILD_VERSION was computed from the tag and then never used, so any release
would have carried the literal <Version>0.5.0</Version> from
Directory.Build.props.
'gh run list --workflow=publish-to-nuget.yml' returns nothing: this workflow
has never run once. So none of the above ever surfaced, and the secret sat there
regardless.
Now: packs both packable projects with -p:Version from the tag, pushes with
dotnet nuget push, and authorizes through Trusted Publishing — the GitHub OIDC
token exchanged for a key valid ~1 hour, no long-lived secret. Also fixes the
pwsh Import-Module path, which used backslashes on a Linux runner.
Requires a Trusted Publishing policy on nuget.org covering both package ids and
the NUGET_USER secret before the first real release.
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.
This started as a credential migration and turned into a repair. The publish job held a live
NUGET_API_KEYwhile being incapable of publishing anything.gh run list --workflow=publish-to-nuget.ymlreturns nothing — this workflow has never run once, so none of the following ever surfaced:build/testrun on separate runners and nothing carried their output over.nuget pushnuget.exeCLI, which is not present onubuntu-latest.**\*.nupkgBUILD_VERSIONunused<Version>0.5.0</Version>fromDirectory.Build.props.Import-Module .\build\…What it does now
Packs both packable projects (
Atypical.VirtualFileSystem,Atypical.VirtualFileSystem.GitHub) with-p:Version=$BUILD_VERSIONso the tag actually governs the version, pushes withdotnet nuget push, and authorizes through Trusted Publishing — GitHub's OIDC token exchanged for a key valid ~1 hour, no long-lived secret stored. The only remaining secret isNUGET_USER, the nuget.org profile name.Please review this one more carefully than its siblings
The other six repos in this sweep were credential swaps on working pipelines. This one changes behaviour on a path that has never executed, which means CI passing here proves less than usual — the first real tag is the first genuine test. I would rather you knew that than discover it at release time.
Required before the first release
Atypical-Consulting/VirtualFileSystemandpublish-to-nuget.yml.NUGET_USERsecret.NUGET_API_KEY.