Skip to content

Commit 0ba2093

Browse files
committed
Use Node 24 directly instead of upgrading npm
Node 24 ships with npm 11.12.1, already over the 11.5.1 floor for OIDC trusted publishing. Bumping the publish job to Node 24 makes the upgrade step unnecessary — no installer to break, no tarball hack to maintain. Keep the version-floor assertion as a guard so that lowering the Node version back into 22 territory fails with a clear error instead of another misleading registry E404. Other workflows stay on Node 22; only the publish path needs npm 11.5+.
1 parent fbf34a3 commit 0ba2093

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

.github/workflows/release-typescript.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,18 @@ jobs:
7777
- name: Setup Node.js
7878
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] -- cache is branch-isolated; fork PRs cannot write to this cache
7979
with:
80-
node-version: '22'
80+
# Node 24 ships npm 11.12.1, which clears the 11.5.1 floor for OIDC
81+
# trusted publishing. Node 22's bundled npm 10.9.7 does not, and its
82+
# `npm install -g npm@latest` self-upgrade is currently broken.
83+
node-version: '24'
8184
registry-url: 'https://registry.npmjs.org'
8285
cache: 'npm'
8386
cache-dependency-path: typescript/package-lock.json
8487

85-
- name: Install npm 11+ for OIDC trusted publishing
86-
# `npm install -g npm@latest` crashes on Node 22's bundled npm 10.9.7
87-
# (arborist depends on a missing promise-retry). Replace the bundled
88-
# npm in-place with the tarball to bypass the broken installer.
89-
run: |
90-
NPM_VERSION=$(curl -fsSL https://registry.npmjs.org/npm/latest | node -e 'let s=""; process.stdin.on("data", d => s += d).on("end", () => console.log(JSON.parse(s).version))')
91-
echo "Installing npm@$NPM_VERSION (was $(npm --version))"
92-
NPM_DIR="$(node -e 'console.log(require("path").dirname(require("path").dirname(process.execPath)))')/lib/node_modules/npm"
93-
rm -rf "$NPM_DIR"
94-
mkdir -p "$NPM_DIR"
95-
curl -fsSL "https://registry.npmjs.org/npm/-/npm-${NPM_VERSION}.tgz" | tar -xz -C "$NPM_DIR" --strip-components=1
96-
echo "npm version: $(npm --version)"
97-
9888
- name: Verify npm version supports trusted publishing
9989
run: |
10090
INSTALLED=$(npm --version)
91+
echo "npm version: $INSTALLED"
10192
node -e 'const [M,m,p]=process.argv[1].split(".").map(Number); process.exit(M > 11 || (M === 11 && (m > 5 || (m === 5 && p >= 1))) ? 0 : 1)' "$INSTALLED" || {
10293
echo "::error::npm $INSTALLED is too old for trusted publishing (need 11.5.1+)"
10394
exit 1

0 commit comments

Comments
 (0)