clone

a self-hosted sync node for lofi apps: jazz sync over iroh, ticket-gated, with no static ip or cloud needed

feat/connection-observability
lofi-node / tools / release_artifacts.ts
release_artifacts.ts 1.8K
1// Regenerates src/native/artifacts.ts from native/iroh-js/prebuilt/ and2// deno.json: the release-asset names and sha256 digests the JSR-published3// loader will accept when downloading the native addon from the GitHub4// release. CI verifies the file is fresh (`git diff --exit-code`).5//6// Run: deno task release:artifacts78const TRIPLES: Record<string, { dir: string; ext: string }> = {9 "darwin-aarch64": { dir: "aarch64-apple-darwin", ext: "dylib" },10 "linux-x86_64": { dir: "x86_64-unknown-linux-gnu", ext: "so" },11 "linux-aarch64": { dir: "aarch64-unknown-linux-gnu", ext: "so" },12};1314const version = JSON.parse(await Deno.readTextFile("deno.json")).version as string;1516const assets: Record<string, { file: string; sha256: string }> = {};17for (const [platform, { dir, ext }] of Object.entries(TRIPLES)) {18 const source = `native/iroh-js/prebuilt/${dir}/libnumber0_iroh.${ext}`;19 const bytes = await Deno.readFile(source);20 const digest = await crypto.subtle.digest("SHA-256", bytes);21 const sha256 = [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");22 assets[platform] = { file: `libnumber0_iroh-${dir}.${ext}`, sha256 };23}2425const banner = `// GENERATED by tools/release_artifacts.ts — do not edit by hand.26// Release-asset names + sha256 digests for the native addon; the loader27// downloads these from the GitHub release for version ${version} and refuses28// anything that does not match. Regenerate: deno task release:artifacts2930export const RELEASE_ARTIFACTS = ${JSON.stringify({ version, assets }, null, 2)} as const;31`;32await Deno.writeTextFile("src/native/artifacts.ts", banner);33console.log(`src/native/artifacts.ts regenerated for v${version}`);34for (const [platform, asset] of Object.entries(assets)) {35 console.log(` ${platform}: ${asset.file} ${asset.sha256.slice(0, 16)}…`);36}