Skip to content

Commit 8cd793c

Browse files
authored
fix: activate pinned npm via corepack in publish workflow (#48)
The publish workflow has been silently failing since v0.3.1 with MODULE_NOT_FOUND: promise-retry during `npm install -g npm@latest`. Root cause: the self-upgrade path on the runner's prebuilt npm tree leaves @npmcli/arborist's dependency graph half-replaced. Discovered while releasing v0.3.2 — both v0.3.1 and v0.3.2 tags exist on GitHub but neither version is actually on npm; `npm view @aictrl/cli versions` tops out at 0.3.0. This is why the optionalDependencies fix from #46 hadn't reached users. Switch to `corepack prepare [email protected] --activate`: corepack installs to its own shim directory and never touches the bundled npm tree, so the self-upgrade corruption path is unreachable. Pinning to 11.5.2 (minimum OIDC trusted publishing support + 2 patch releases) instead of tracking a moving `@latest` target.
1 parent 02d828f commit 8cd793c

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,21 @@ jobs:
2121
with:
2222
node-version: 22
2323

24-
- name: Upgrade npm for OIDC trusted publishing
25-
run: npm install -g npm@latest
24+
- name: Activate pinned npm via corepack for OIDC trusted publishing
25+
# npm's OIDC trusted publishing support requires npm >= 11.5.0, but the
26+
# runner's bundled npm (10.9.x) is older. Previously this step ran
27+
# `npm install -g npm@latest`, which self-corrupted on the runner's
28+
# prebuilt tree and produced MODULE_NOT_FOUND for promise-retry —
29+
# silently breaking every release since v0.3.1.
30+
#
31+
# Corepack ships with Node 22 and installs package managers to its
32+
# own shim directory, sidestepping the self-upgrade corruption path
33+
# entirely. Pinning to a specific version stops tracking a moving
34+
# target that has historically shipped regressions.
35+
run: |
36+
corepack enable
37+
corepack prepare [email protected] --activate
38+
npm --version
2639
2740
- name: Install dependencies
2841
run: bun install

0 commit comments

Comments
 (0)