From 2cbd78f05182807503d09eeb89c9ae02afbfe095 Mon Sep 17 00:00:00 2001 From: Henry Kaufman Date: Tue, 29 Sep 2026 13:45:29 -0400 Subject: [PATCH] ci: install deps before upgrading npm, so native builds are not skipped Second release attempt failed the same way as the first, and the Node version was not the cause. npm 11 blocks dependency install scripts unless they are listed in allowScripts: npm warn install-scripts 2 packages had install scripts blocked better-sqlite3@11.10.0 (install: prebuild-install || node-gyp rebuild) Because the workflow ran `npm install -g npm@latest` BEFORE `npm ci`, the native module was never built and `npm run fixture` died with "Could not locate the bindings file". ci.yml passes because it installs with the npm bundled with Node. Fix is ordering, not configuration: install with the bundled npm exactly as ci.yml does, then upgrade npm immediately before publish, which is the only step that needs 11.5.x for OIDC. Not using allowScripts: local npm here is 10.9.8 and does not know the key, so the syntax cannot be verified before pushing, and an unverified config change is how the last two attempts were spent. Worth revisiting when npm 11 ships as the bundled default, because local `npm ci` will hit the same block then. The OIDC handshake is still unverified; no run has reached `npm publish` yet. Claude-Session: https://claude.ai/code/session_01LMbjcZogpv9EbVnqovXpSX --- .github/workflows/publish.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aac6578..97103cc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,16 +39,6 @@ jobs: # No dependency cache in a release build: the artifact that goes to # the registry should be built from a clean install every time. - # OIDC support landed in npm 11.5.x, newer than the npm bundled with - # Node 22, so upgrade explicitly. npm@latest needs Node ^22.22.2, which - # setup-node's "22" satisfies. Versions are echoed so a future runner - # image change is diagnosable from the log alone. - - name: Ensure npm supports OIDC - run: | - node --version - npm install -g npm@latest - npm --version - - name: Refuse to publish if the tag and package.json disagree run: | TAG="${GITHUB_REF_NAME#v}" @@ -59,10 +49,25 @@ jobs: exit 1 fi + # Install with the npm BUNDLED with Node 22 — the same npm ci.yml uses. + # npm 11 blocks dependency install scripts unless they are listed in + # allowScripts, which silently skips better-sqlite3's prebuild-install and + # leaves the native module unbuilt. Upgrading npm before this step is what + # broke the first two release attempts. - run: npm ci - run: npm run fixture - run: npm test + # Only now upgrade npm: OIDC support landed in npm 11.5.x, newer than the + # npm bundled with Node 22. Publishing needs the new npm; installing needs + # the old one. Versions are echoed so a runner image change is + # diagnosable from the log alone. + - name: Ensure npm supports OIDC + run: | + node --version + npm install -g npm@latest + npm --version + # No NODE_AUTH_TOKEN. Authentication comes from the OIDC exchange, and # provenance is attached automatically for a public repo + public package. - run: npm publish