ci(cli-auth): publish via npx npm@11 instead of global self-upgrade#26
Merged
Conversation
The 'npm install -g npm@latest' step on ubuntu-latest started failing with 'Cannot find module promise-retry' because npm's self-upgrade leaves the install in a broken intermediate state. Switch to 'npx --yes npm@11 publish' so the publish runs against a clean pinned npm without touching the runner's global install. npm 11.x still satisfies the Trusted Publisher / --provenance requirements.
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
First run of the Publish workflow (triggered by pushing tag
v0.1.0-beta.0) failed at thenpm install -g npm@lateststep with:This is a known self-upgrade breakage: when
npm install -g npm@latestruns with the runner-bundled npm, the new version partially replaces files from the old install and leaves the global npm in a broken intermediate state before the next command runs.Instead of fighting the self-upgrade, run publish against a clean pinned npm via
npx:npm@11satisfies the>= 11.5.1floor we need for Trusted Publisher +--provenance. The--yesflag skips thenpxinstall prompt. The oldEnsure npm >= 11.5.1step is removed.Re-triggering the release after merge
Tag
v0.1.0-beta.0has already been pushed, but it points at the broken workflow commit. After this PR merges:(Alternatively, leave the tag where it is and use
workflow_dispatchfrom the Actions tab — it will check out current master, which has the fix. Re-tagging is cleaner for keeping provenance history tied to the right commit.)Testing
Ran
npx --yes npm@11 publish --dry-run --tag betalocally insidepackages/cli-auth:cli-auth-0.1.0-beta.0.tgz, 33 files, 42.0 kB packed / 158.5 kB unpacked.dist/,README.md,LICENSE,package.json.Publishing to https://registry.npmjs.org/ with tag beta and default access.Non-blocking warning worth noting (not fixed here to keep this PR tight): npm normalized
repository.urlfromhttps://…togit+https://…. Worth a follow-upnpm pkg fixcommit, but it does not affect publishing.