From d6070cc18578c34683d3fd547de00d8dd5210668 Mon Sep 17 00:00:00 2001 From: CRT Date: Fri, 16 Oct 2026 07:48:55 +0800 Subject: [PATCH] release: when the published version is still missing from the registry after 2 minutes, publish once more (0.8.10's publish answered 0 and left nothing) --- tools/release.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/release.ts b/tools/release.ts index de981a5..f32af01 100644 --- a/tools/release.ts +++ b/tools/release.ts @@ -425,7 +425,19 @@ async function npmRelease(version: string, token: string): Promise { // the registry lags a little after a publish; wait (timeout, heartbeat) until it serves the version as latest const end = Date.now() + 5 * 60_000; let last = 0; + let again = false; for (;;) { + // a publish that answered 0 once left no version on the registry (0.8.10): publish once more when the version is + // still missing after 2 minutes (a second publish of a version that landed answers "cannot publish over") + if (!again && Date.now() > end - 3 * 60_000) { + const v = spawnSync('npm', ['view', `storebound@${version}`, 'version'], { encoding: 'utf8', timeout: 30_000 }); + if (!(v.stdout ?? '').trim()) { + again = true; + say(`npm: ${version} is not on the registry yet: publishing once more`); + const p2 = npmRun(['publish'], token); + if (p2.code !== 0 && !/previously published|cannot publish over/i.test(p2.out)) fail(`npm publish (second try) failed: ${p2.out.trim().split('\n').slice(-4).join(' ')}`); + } + } const r = spawnSync('npm', ['view', 'storebound', 'dist-tags.latest'], { encoding: 'utf8', timeout: 30_000 }); if ((r.stdout ?? '').trim() === version) break; if (Date.now() > end) fail(`npm: ${version} published but the registry still serves ${(r.stdout ?? '').trim()} as latest after 5 min`);