release: the dev-channel job never gates a release; desktop-dev retries the live dev latest.json on 5xx

This commit is contained in:
CRTkafa 2026-10-26 11:05:08 +07:00
parent 1030cdff0c
commit 05d0e227a1
2 changed files with 11 additions and 6 deletions

View file

@ -62,10 +62,14 @@ export function pruneDev<T extends { tag_name: string }>(releases: T[], keep = K
}
async function liveDev(): Promise<string | null> {
const r = await fetch(`${DEV_URL}?t=${Date.now()}`, { signal: AbortSignal.timeout(20_000) }).catch(() => null);
if (!r || r.status === 404) return null;
if (!r.ok) throw new Error(`${DEV_URL}: HTTP ${r.status}`);
return ((await r.json()) as { version?: string }).version ?? null;
// a 5xx from the CDN / origin is often a blip: try a few times before giving up
for (let i = 0; ; i++) {
const r = await fetch(`${DEV_URL}?t=${Date.now()}`, { signal: AbortSignal.timeout(20_000) }).catch(() => null);
if (r?.status === 404) return null;
if (r?.ok) return ((await r.json()) as { version?: string }).version ?? null;
if (i >= 4) throw new Error(`${DEV_URL}: ${r ? `HTTP ${r.status}` : 'no answer'} after ${i + 1} tries`);
await new Promise(res => setTimeout(res, 5_000 * (i + 1)));
}
}
function commitDate(): Date {