Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
23 changes: 22 additions & 1 deletion scripts/release-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading