Files
desktop/ci-scripts/generate-updates-json.ts
zeekay 44c62a9844 ci(release): all-platform native binaries + stable download aliases
- release-prod: build macOS UNIVERSAL (arm64+x86_64) .dmg; discover installers
  by glob (productName is "Hanzo", old hardcoded "Hanzo Desktop_" paths were dead)
- emit stable unversioned aliases hanzo-macos.dmg / hanzo-windows.exe /
  hanzo-linux.AppImage (+ arm64 AppImage, .deb, .msi) alongside versioned names
- make_latest:true on the GitHub Release; publish stable copies to public R2
  latest/ prefix (download.hanzo.ai/hanzo-desktop/latest/<name>)
- tauri bundle targets add deb + msi (one list, per-platform subset)
- download-side-binaries: add x86_64-apple-darwin (enables universal mac)
- generate-updates-json: list only platforms that built (fail-fast:false safe);
  universal mac bundle now also serves darwin-x86_64 auto-updates
- drop dead tauri-build-matrix.yml (v* trigger never fired; never released)
- bump actions/github-script v3 -> v7
2026-07-20 16:08:42 -07:00

56 lines
2.1 KiB
TypeScript
Executable File

import fs from 'fs';
import { formatRFC3339 } from 'date-fns';
import z from 'zod';
const envSchema = z.object({
JSON_PATH: z.string().min(1),
VERSION: z.string().min(5),
NOTES: z.string().min(1),
PUB_DATE: z.string().optional(),
DARWIN_AARCH64_SIGNATURE: z.string().optional(),
DARWIN_AARCH64_URL: z.string().optional(),
LINUX_x86_64_SIGNATURE: z.string().optional(),
LINUX_x86_64_URL: z.string().optional(),
LINUX_AARCH64_SIGNATURE: z.string().optional(),
LINUX_AARCH64_URL: z.string().optional(),
WINDOWS_x86_64_SIGNATURE: z.string().optional(),
WINDOWS_x86_64_URL: z.string().optional(),
});
const env = envSchema.parse(process.env);
// Only list a platform when this run actually produced a signed updater bundle
// for it. The release matrix is fail-fast:false, so a leg can legitimately be
// absent (e.g. an offline self-hosted runner). The Tauri updater treats a
// missing platform as "no update available" for that OS — the correct graceful
// behaviour — so a partial matrix must NOT fail the rollout.
const platforms: Record<string, { signature: string; url: string }> = {};
const add = (key: string, signature?: string, url?: string) => {
if (signature && signature.length > 0 && url && url.length > 0) {
platforms[key] = { signature, url };
}
};
// The macOS build is a UNIVERSAL bundle (arm64 + x86_64), so the single signed
// .app.tar.gz serves both darwin architectures.
add('darwin-aarch64', env.DARWIN_AARCH64_SIGNATURE, env.DARWIN_AARCH64_URL);
add('darwin-x86_64', env.DARWIN_AARCH64_SIGNATURE, env.DARWIN_AARCH64_URL);
add('linux-x86_64', env.LINUX_x86_64_SIGNATURE, env.LINUX_x86_64_URL);
add('linux-aarch64', env.LINUX_AARCH64_SIGNATURE, env.LINUX_AARCH64_URL);
add('windows-x86_64', env.WINDOWS_x86_64_SIGNATURE, env.WINDOWS_x86_64_URL);
if (Object.keys(platforms).length === 0) {
throw new Error(
'No platform produced a signed updater bundle; refusing to write an empty updates.json',
);
}
const updatesJson = {
version: env.VERSION,
notes: env.NOTES,
pub_date: env.PUB_DATE || formatRFC3339(new Date()),
platforms,
};
fs.writeFileSync(env.JSON_PATH, JSON.stringify(updatesJson, null, 2));