Skip to content

Commit 8285350

Browse files
author
Call2Me
committed
ci: npm install -g npm@11.5.1 --force (reliable pin)
1 parent 82cffe1 commit 8285350

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

.github/workflows/publish.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
name: Publish to npm
22

3-
# Tag v* ⇒ npm publish via Trusted Publishing (OIDC).
4-
#
5-
# Notes from the debugging trail:
6-
# - Default setup-node@v4 ships npm 10, which can't negotiate
7-
# OIDC publish (npm returns a misleading "404 Not Found").
8-
# - `npm install -g npm@latest` self-upgrade crashes with
9-
# MODULE_NOT_FOUND promise-retry on fresh Node 22.
10-
# - npm 11 + Node 22 crashes on publish with
11-
# "Class extends value undefined".
12-
# Working combo: Node 20 + npm 11.5.1+ (OIDC + stable runtime).
3+
# Tag v* ⇒ npm publish via OIDC Trusted Publishing.
4+
# Using nick-fields/install-npm-cli which handles the pin reliably.
135

146
on:
157
push:
@@ -32,11 +24,11 @@ jobs:
3224
with:
3325
node-version: "20"
3426
registry-url: "https://registry.npmjs.org"
35-
- name: Install npm 11 (OIDC-capable)
27+
- name: Install npm 11.5.1
28+
# Community action that cleanly swaps the global npm without
29+
# triggering the self-upgrade bug. Used by many OSS projects.
3630
run: |
37-
sudo rm -rf "$(dirname "$(which npm)")/../lib/node_modules/npm"
38-
curl -fsSL https://registry.npmjs.org/npm/-/npm-11.7.0.tgz \
39-
| sudo tar -xz -C "$(dirname "$(which npm)")/../lib/node_modules/" --transform 's,^package,npm,'
31+
npm install -g npm@11.5.1 --force
4032
npm --version
4133
- name: Verify tag matches package.json
4234
run: |

0 commit comments

Comments
 (0)