Skip to content

Commit 8565b0d

Browse files
mishushakovclaude
andcommitted
Bootstrap npm via tarball, then upgrade to 11.x normally
Use npm 10.9.8 (first version with the @npmcli/arborist self-upgrade fix) as a tarball bootstrap so `npm install -g npm@^11.6` works via the normal path. Drop the now-redundant `NPM_TOKEN: ""` — changesets/ action v1.7.0+ only writes the auth token when NPM_TOKEN is defined. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent a4e2f1e commit 8565b0d

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,19 @@ jobs:
344344
pnpm config set exclude-links-from-lockfile true
345345
346346
- name: Update npm
347-
# Workaround: the pre-installed npm on the Node 22 runner image ships
348-
# with a broken @npmcli/arborist (missing promise-retry), so `npm
349-
# install -g npm@11` fails during reify. Replace npm via tarball.
350-
# npm 11+ is required for OIDC trusted publishing (NPM_TOKEN="").
347+
# The Node 22 runner image ships npm 10.9.7, whose @npmcli/arborist
348+
# lazy-loads promise-retry and crashes mid self-upgrade. npm 10.9.8
349+
# (arborist 8.0.5) fixed that by eagerly loading it. We tarball-install
350+
# 10.9.8 as a bootstrap, then use normal `npm install -g` to reach
351+
# npm 11+ which is required for OIDC trusted publishing.
352+
# TODO: drop the tarball step once the runner image ships npm >= 10.9.8.
351353
run: |
352-
NPM_VERSION="11.9.0"
354+
NPM_BOOTSTRAP_VERSION="10.9.8"
353355
NPM_DIR="$(dirname "$(dirname "$(which node)")")/lib/node_modules/npm"
354356
sudo rm -rf "${NPM_DIR}"
355357
sudo mkdir -p "${NPM_DIR}"
356-
curl -fsSL "https://registry.npmjs.org/npm/-/npm-${NPM_VERSION}.tgz" | sudo tar -xz -C "${NPM_DIR}" --strip-components=1
358+
curl -fsSL "https://registry.npmjs.org/npm/-/npm-${NPM_BOOTSTRAP_VERSION}.tgz" | sudo tar -xz -C "${NPM_DIR}" --strip-components=1
359+
npm install -g npm@^11.6
357360
npm --version
358361
359362
- name: Install dependencies
@@ -371,7 +374,6 @@ jobs:
371374
createGithubReleases: true
372375
env:
373376
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
374-
NPM_TOKEN: "" # See https://github.com/changesets/changesets/issues/1152#issuecomment-3190884868
375377
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
376378

377379
- name: Update lock file

0 commit comments

Comments
 (0)