Skip to content

Commit 4a85ca6

Browse files
committed
ci(release): verify bitgo tarball installs on node 20 and node 24
Adds a post-publish verify-consumer-install job that runs a real `npm install bitgo@<newVersion>` in an isolated tempdir with engine-strict=true on a [20.x, 24.x] node matrix. Catches shrinkwrap engine regressions before they hit customers — the sanitize-html@2.17.6 lockout would have failed here instead of blocking a release train. Retries only on E404/ETARGET registry propagation lag. EBADENGINE and other install failures fail immediately. TICKET: WCN-2091
1 parent 9d3ba18 commit 4a85ca6

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/npmjs-release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,71 @@ jobs:
403403
echo "::error::All retry attempts exhausted creating GitHub release v${{ steps.extract-version.outputs.new-version }}. NPM publish succeeded; manual GitHub release required."
404404
exit 1
405405
406+
# WCN-2091: verify the published bitgo tarball actually installs on the minimum
407+
# supported Node version with engine-strict. The generated shrinkwrap freezes
408+
# whatever transitive versions npm resolved on the release runner (Node 24),
409+
# and if any of those pin `engines.node >=22` the release breaks Node 20
410+
# consumers post-publish. Matrix so we catch both a min-version regression
411+
# (20.x) and a self-consistency check on our nvmrc (24.x).
412+
verify-consumer-install:
413+
name: Verify consumer install (Node ${{ matrix.node-version }})
414+
if: ${{ always() && inputs.dry-run == false && needs.release-bitgojs.result == 'success' }}
415+
needs:
416+
- release-bitgojs
417+
runs-on: ${{ vars.BASE_RUNNER_TYPE || 'ubuntu-latest' }}
418+
timeout-minutes: 15
419+
strategy:
420+
fail-fast: false
421+
matrix:
422+
node-version: ['20.x', '24.x']
423+
steps:
424+
- name: Checkout repository
425+
uses: actions/checkout@v6
426+
with:
427+
ref: rel/latest
428+
fetch-depth: 1
429+
430+
- name: Setup Node.js ${{ matrix.node-version }}
431+
uses: actions/setup-node@v6
432+
with:
433+
node-version: ${{ matrix.node-version }}
434+
435+
- name: Simulate standalone consumer install with engine-strict
436+
run: |
437+
version=$(jq -r '.version' modules/bitgo/package.json)
438+
bitgo_name=$(jq -r '.name' modules/bitgo/package.json)
439+
440+
workdir="$(mktemp -d)"
441+
cd "$workdir"
442+
443+
echo "engine-strict=true" > .npmrc
444+
cat > package.json <<EOF
445+
{ "name": "consumer-smoke", "version": "1.0.0", "private": true,
446+
"dependencies": { "$bitgo_name": "$version" } }
447+
EOF
448+
449+
echo "Running: npm install $bitgo_name@$version on $(node --version) with engine-strict=true"
450+
451+
# Registry propagation can lag right after publish. Retry a few times
452+
# on E404/ETARGET only; any EBADENGINE or other failure fails immediately.
453+
for attempt in 1 2 3 4 5; do
454+
if npm install --no-audit --no-fund 2>install.log; then
455+
echo "✅ npm install $bitgo_name@$version succeeded on $(node --version)."
456+
exit 0
457+
fi
458+
if grep -qE 'E404|ETARGET' install.log; then
459+
echo "Registry propagation lag (attempt $attempt/5) — retrying in 10s."
460+
sleep 10
461+
continue
462+
fi
463+
echo "::error::npm install $bitgo_name@$version failed on $(node --version) with engine-strict=true."
464+
cat install.log
465+
exit 1
466+
done
467+
echo "::error::npm install $bitgo_name@$version could not resolve after 5 attempts."
468+
cat install.log
469+
exit 1
470+
406471
get-express-release-context:
407472
name: Get Express release context
408473
if: ${{ always() && inputs.dry-run == false && needs.release-bitgojs.result == 'success' }}

0 commit comments

Comments
 (0)