release candidates: draft assets are read by their attachment uuid (the tag URL is 404 for drafts: the record job could not merge SHA256SUMS); the installers are scanned with the private terms in their build jobs, so the record job needs no apt tools (it spent 5 minutes installing them)

This commit is contained in:
CRTkafa 2026-10-15 01:18:55 +08:00
parent cdaecc2afb
commit 6873f2cc68
5 changed files with 34 additions and 23 deletions

View file

@ -35,7 +35,7 @@ import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSyn
import { basename, join, resolve } from 'node:path';
import { cliKey } from './cli-key';
import { COPIES, SEMVER } from './desktop-version';
import { api, BASE, candidateTag, deleteTest, downloadAsset, isCandidateTag, listReleases, type Release, REPO, shortNotes, SUMS, upsert } from './forgejo-release';
import { api, assetUrl, BASE, candidateTag, deleteTest, downloadAsset, isCandidateTag, listReleases, type Release, REPO, shortNotes, SUMS, upsert } from './forgejo-release';
const ROOT = resolve(import.meta.dir, '..');
export const GREEN = 'green.json';
@ -147,7 +147,7 @@ async function tasks(): Promise<Task[]> {
async function record(release: Release): Promise<GreenRecord | null> {
const a = release.assets.find(x => x.name === GREEN);
if (!a) return null;
return JSON.parse(await api<string>('GET', a.browser_download_url, undefined, true)) as GreenRecord;
return JSON.parse(await api<string>('GET', assetUrl(a), undefined, true)) as GreenRecord;
}
export async function status(sha: string): Promise<Status> {
@ -180,7 +180,7 @@ export async function fetchCandidate(s: Extract<Status, { state: 'green' }>, dir
await Promise.all(assets.map(async a => {
const dest = join(dir, a.name);
if (existsSync(dest) && s.record.files[a.name] && sha256(dest) === s.record.files[a.name]) { got.push(dest); return; }
await downloadAsset(a.browser_download_url, dest);
await downloadAsset(assetUrl(a), dest);
const want = s.record.files[a.name];
if (want && sha256(dest) !== want) fail(`${a.name}: SHA-256 differs from the candidate's record`);
got.push(dest);