Skip to content

ci: run npm publish via npx-pinned npm@latest for OIDC#19

Merged
walkindude merged 1 commit into
masterfrom
ci/use-npx-for-publish
May 4, 2026
Merged

ci: run npm publish via npx-pinned npm@latest for OIDC#19
walkindude merged 1 commit into
masterfrom
ci/use-npx-for-publish

Conversation

@walkindude
Copy link
Copy Markdown
Owner

Summary

Follow-up to #18. The first nightly attempt with #18's npm install -g npm@latest failed with MODULE_NOT_FOUND: Cannot find module 'promise-retry' — a known fragility where npm 10 partially self-overwrites with npm 11 (which dropped promise-retry), but the in-flight rebuild step still requires it.

Switching to npx --package=npm@latest -- npm publish .... npx fetches npm@latest into its cache and invokes that isolated binary, so the system npm stays at 10.x and never mutates itself. The OIDC env vars (ACTIONS_ID_TOKEN_REQUEST_URL / _TOKEN) are process-env, so the npx subprocess inherits them — provenance + Trusted Publishing both still work.

Why not bump Node to 24?

Node 24 ships with npm 11 baked in, which would also work — but mise.toml pins Node 22 for contributor dev consistency. Bumping just CI's setup-node to 24 fights with mise-action's PATH order, and bumping mise.toml is a bigger contributor-facing change. The npx-pinned approach is local to the publish step and decoupled from runtime Node.

Test plan

  • Merge → next master nightly. Expect cli-bridge@0.1.2-nightly.<date>.<sha> to land on npm with dist-tag=nightly. latest stays at 0.1.2.
  • Verify npm view cli-bridge@nightly returns the new version.

🤖 Generated with Claude Code

Replaces the failed-self-upgrade path. `npm install -g npm@latest`
under npm 10 corrupts mid-overwrite (npm 11 dropped promise-retry,
which the in-flight rebuild step still requires) and exits with
MODULE_NOT_FOUND. Trusted Publishing needs npm 11.5.1+ for OIDC
auto-detection.

`npx --package=npm@latest -- npm publish ...` runs an isolated
npm 11 from the npx cache without mutating the system npm. OIDC
token env vars (ACTIONS_ID_TOKEN_REQUEST_URL/_TOKEN) are inherited,
so provenance + Trusted Publishing both work.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@walkindude walkindude merged commit 60502e9 into master May 4, 2026
11 checks passed
@walkindude walkindude deleted the ci/use-npx-for-publish branch May 4, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant