waybetter-for-x/scripts/release.mjs
2026-09-30 23:01:13 +00:00

33 lines
2 KiB
JavaScript

#!/usr/bin/env node
// Builds a signed Windows release and writes the update manifest. It never uploads anything:
// it prints the exact upload steps for the owner to run. The work is the framework's
// (`waybetter release windows`, waybetter/packages/waybetter/cli/release.mjs), configured by
// waybetter.release.json (product and file names, key folder, CDN and API URLs, and the shared
// contract's NativeRelease schema as the manifest validator).
//
// node scripts/release.mjs [--skip-build] [--notes "text"]
//
// Privacy: the build runs with `waybetter build-env` (no absolute build path, so no account name,
// in the binary), and the installer (opened with 7-Zip), the binary and the front end must pass
// `waybetter privacy-scan` against ~/.better-twttr-keys/forbidden-names.txt before anything is
// copied to releases/. The .pdb next to the binary holds every path: never publish it.
//
// Env:
// CARGO_TARGET_DIR optional; the bundle is read from <it>/release/bundle/nsis
// BT_KEYS_DIR folder holding native.key (default: ~/.better-twttr-keys). Never commit it.
// CDN_BASE public base URL for installers (default: https://cdn1.crt.fyi/better-twttr)
// DEPLOY_TARGET ssh target for the printed steps, e.g. user@host (no default: printed as a placeholder)
// CDN_DIR remote folder behind CDN_BASE (placeholder when unset)
// RELEASES_DIR remote API RELEASES_DIR (placeholder when unset)
// WAYBETTER_FORBIDDEN_TERMS another terms file; WAYBETTER_7Z 7-Zip when it is not installed in Program Files
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { releaseCommand } from '../waybetter/packages/waybetter/cli/release.mjs';
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
try {
await releaseCommand(['windows', ...process.argv.slice(2)], { cwd: root });
} catch (error) {
console.error(`release: ${error instanceof Error ? error.message : error}`);
process.exit(1);
}