From 78d53ef3ba57069b6b53a39640973cb00a1b4c72 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Wed, 4 Nov 2026 18:50:46 +0100 Subject: [PATCH 1/2] Check out release verification scripts in the publish job --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 459763b..7342c2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,9 +18,6 @@ jobs: runs-on: ubuntu-24.04 timeout-minutes: 10 steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 @@ -47,6 +44,9 @@ jobs: contents: read id-token: write steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: package From fa2caf915b5c38abfdc45389c099e3f362a9d23f Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Wed, 4 Nov 2026 18:55:22 +0100 Subject: [PATCH 2/2] Preserve newer npm releases on retry --- scripts/release-files.mjs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/release-files.mjs b/scripts/release-files.mjs index f00f4ef..b64b754 100644 --- a/scripts/release-files.mjs +++ b/scripts/release-files.mjs @@ -32,7 +32,28 @@ async function published() { } if (mode === "select") { - console.log((await published()) ? "present" : "missing"); + if (await published()) { + console.log("present"); + } else { + const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(name)}/latest`, { + signal: AbortSignal.timeout(30000), + }); + if (response.ok) { + const latest = await response.json(); + if (latest.name !== name || !/^\d+\.\d+\.\d+$/.test(latest.version)) { + throw new Error("Unexpected npm latest release"); + } + const wanted = version.split(".").map(Number); + const current = latest.version.split(".").map(Number); + const index = current.findIndex((value, i) => value !== wanted[i]); + if (index === -1 || current[index] > wanted[index]) { + throw new Error("Refusing to move the npm latest tag back to an older release"); + } + } else if (response.status !== 404) { + throw new Error(`npm latest lookup returned HTTP ${response.status}`); + } + console.log("missing"); + } } else { for (let attempt = 0; !(await published()); attempt++) { if (attempt === 5) throw new Error("Published npm tarball is missing");