26 lines
684 B
TypeScript
26 lines
684 B
TypeScript
import { readFile } from "node:fs/promises";
|
|
|
|
import {
|
|
RELEASE_CANDIDATE_MANIFEST_PATH,
|
|
verifyReleaseCandidate,
|
|
} from "./lib/release-candidate.ts";
|
|
|
|
let document: unknown = null;
|
|
try {
|
|
document = JSON.parse(
|
|
await readFile(RELEASE_CANDIDATE_MANIFEST_PATH, "utf8"),
|
|
);
|
|
} catch {
|
|
// The verifier reports a single fail-closed schema error below.
|
|
}
|
|
const result = await verifyReleaseCandidate(document);
|
|
if (result.failures.length > 0) {
|
|
process.stderr.write(
|
|
`Release candidate verification failed:\n- ${result.failures.join("\n- ")}\n`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
process.stdout.write(
|
|
`Release candidate verification: PASS (${result.manifest!.distSha256})\n`,
|
|
);
|