Push each package by path: pwsh does not expand the glob - #224
Merged
Conversation
The 1.1.0 release got as far as the push and then failed with
error: File does not exist (nupkgs/*.nupkg).
because this job runs on windows-latest, where pwsh does not expand wildcards in
arguments - so `dotnet nuget push nupkgs/*.nupkg` arrived literally. The workflow this
was modelled on runs on Linux, where bash expands the glob before dotnet sees it, which
is why the line looked fine. No dry run could catch it: the push is gated on the release
event, so it had never executed.
Now enumerates the files and pushes each by full path, which does not depend on the
shell, and fails loudly if there are none rather than silently pushing nothing. Kept
--skip-duplicate so a partial push stays safely re-runnable, and checks $LASTEXITCODE
per file, since a failing dotnet inside a foreach would not otherwise fail the step.
1.1.0 itself was published by hand from the run artifact - the packages were already
built correctly from the tagged commit, and re-running would have rebuilt from the tag
anyway, without this fix in it.
Also records the release procedure in state-of-play, including the two things that cost
real time: NUGET_USER must be the policy *creator* (not the org that owns the policy),
and versionHeightOffset is a fixed shift that drifts with every commit landing on main
before the tag.
No offset change: with 1.1.0 published, main should move on to 1.1.1, which -4 gives.
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.
The 1.1.0 release got all the way to the push and then failed:
This job runs on
windows-latest, where pwsh does not expand wildcards in arguments — sodotnet nuget push nupkgs/*.nupkgarrived atdotnetliterally. The workflow this was modelled on runs onubuntu-latest, where bash expands the glob first, which is why the line looked correct.No dry run could have caught it: the push is gated on
github.event_name == 'release', so it had never executed until there was a real release.The fix
Enumerate and push by full path, so it doesn't depend on shell behaviour:
Three deliberate details: it throws when there are no packages rather than silently pushing nothing (the same class of failure as the hidden-
.nupkgsbug in #223, which was green-but-empty); it keeps--skip-duplicateso a partial push is safely re-runnable; and it checks$LASTEXITCODEper file, because a failingdotnetinside aforeachwould not otherwise fail the step.1.1.0 itself
Published by hand from the run artifact. The packages were already built correctly from the tagged commit, and re-running wouldn't have helped — a
releaseevent builds from the tag, so it would have rebuilt0e071bfwithout this fix. Getting the fix into 1.1.0 would have meant retagging and re-deriving the offset, to avoid two manual pushes of packages CI had already validated.The OIDC half now works:
NuGet loginsucceeded on the re-run onceNUGET_USERwas the policy creator.Also: the release procedure is written down
state-of-play.mdgains a "Releasing" section — the steps, plus the two things that cost real time:NUGET_USERis the policy creator, not the policy owner. Policies are created from your own nuget.org account with an owner dropdown; picking theDapperorg there scopes the policy to org-owned packages, but the token exchange looks up policies created by the username passed. PassingDappergivesHTTP 401 … No matching trust policy owned by user.versionHeightOffsetis a fixed shift, not a pin — it drifts with every commit landing on main before the tag. Simulate a squash-merge rather than reasoning about it, since branch-local numbers mislead.Version
No offset change. With 1.1.0 published, main should now move on to 1.1.1, which
-4gives naturally — simulated:{'VersionHeight': 5, 'BuildNumber': 1, 'NuGetPackageVersion': '1.1.1'}.