51 lines
3.1 KiB
JavaScript
51 lines
3.1 KiB
JavaScript
#!/usr/bin/env node
|
|
// Adds a macOS build to the release: signs the updater bundle here (the private key never leaves
|
|
// this machine), copies the files into releases/upload/ and adds the darwin platforms to
|
|
// releases/native/latest.json next to the ones already there. It never uploads anything.
|
|
//
|
|
// Or let the framework do the build too, from the COMMITTED state (HEAD + the submodule at its pointer,
|
|
// exported with git archive, built on the Mac over SSH, scanned here):
|
|
// WAYBETTER_MAC_SSH=<user>@<host> WAYBETTER_MAC_SSH_KEY=<key file> node scripts/release-macos.mjs --build-only
|
|
// (without --build-only it continues with the signing below). The manual steps that follow are what it runs.
|
|
//
|
|
// The macOS build itself runs on the MacBook, unsigned (no TAURI_SIGNING_PRIVATE_KEY there), from
|
|
// a clean checkout of the release commit:
|
|
// bun install && bun run --cwd packages/contracts build
|
|
// echo '{"bundle":{"macOS":{"signingIdentity":"-"}}}' > /tmp/adhoc.json # no Developer ID yet
|
|
// cd apps/desktop && bun ../../waybetter/packages/waybetter/bin/waybetter.mjs build-env -- \
|
|
// bunx tauri build --target universal-apple-darwin --bundles app,dmg --ci --config /tmp/adhoc.json
|
|
// (`waybetter build-env`: without it the binary holds about 1,800 absolute build paths with the
|
|
// Mac account name; with it they read /cargo, /rustup, /src and /home.)
|
|
// (rustup with the aarch64-apple-darwin and x86_64-apple-darwin targets; Homebrew rust lacks the
|
|
// x86_64 std.) The ad-hoc signature seals the bundle, so a downloaded copy gets Gatekeeper's
|
|
// "unidentified developer" path (System Settings > Privacy & Security > Open Anyway) instead of
|
|
// "is damaged". Tauri still writes the updater bundle (<target>/universal-apple-darwin/release/bundle/macos/
|
|
// wayBetter for X.app.tar.gz) and then exits non-zero because it cannot sign it; that is expected.
|
|
// Copy the .dmg and the .app.tar.gz back here, then:
|
|
//
|
|
// node scripts/release-macos.mjs --dmg <file.dmg> --updater <file.app.tar.gz>
|
|
//
|
|
// Both files go through `waybetter privacy-scan` first (the dmg's image and the .app inside the
|
|
// updater bundle are opened): a forbidden name in either stops this script before anything is
|
|
// copied or signed.
|
|
//
|
|
// A universal build serves both darwin-aarch64 and darwin-x86_64. Run scripts/release.mjs (Windows)
|
|
// first: this script keeps every platform already in latest.json and refuses a version mismatch.
|
|
//
|
|
// The work is the framework's (`waybetter release macos`, waybetter/packages/waybetter/cli/release.mjs),
|
|
// configured by waybetter.release.json.
|
|
//
|
|
// Env:
|
|
// BT_KEYS_DIR folder holding native.key (default: ~/.better-twttr-keys). Never commit it.
|
|
// CDN_BASE public base URL (default: https://cdn1.crt.fyi/better-twttr)
|
|
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(['macos', ...process.argv.slice(2)], { cwd: root });
|
|
} catch (error) {
|
|
console.error(`release-macos: ${error instanceof Error ? error.message : error}`);
|
|
process.exit(1);
|
|
}
|