hololake-platform/scripts/build-macos-internal.sh

31 lines
1.3 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
[[ "$(uname -s)" == "Darwin" ]] || { echo "macOS internal packages must be built on macOS." >&2; exit 2; }
target="${HOLOLAKE_MAC_TARGET:-aarch64-apple-darwin}"
version="$(node scripts/internal-release-version.mjs src-tauri/tauri.conf.json "${HOLOLAKE_VERSION:-}")"
output_dir="${HOLOLAKE_OUTPUT_DIR:-$repo_root/artifacts/internal/$version}"
bundle_dir="$repo_root/src-tauri/target/$target/release/bundle/macos"
app="$bundle_dir/HoloLake Era.app"
installer="$output_dir/HoloLake-Era-$version-Mac-internal-aarch64.dmg"
command -v pnpm >/dev/null || { echo "pnpm is required." >&2; exit 2; }
command -v hdiutil >/dev/null || { echo "hdiutil is required." >&2; exit 2; }
mkdir -p "$output_dir"
pnpm install --frozen-lockfile
pnpm tauri build --target "$target" --bundles app
[[ -d "$app" ]] || { echo "No macOS application bundle was produced: $app" >&2; exit 1; }
pnpm verify:internal-package "$app"
codesign --force --deep --sign - "$app"
codesign --verify --deep --strict "$app"
hdiutil create -volname "HoloLake Era $version Internal" -srcfolder "$app" -ov -format UDZO "$installer"
hdiutil verify "$installer"
shasum -a 256 "$installer" | sed "s# .*# $(basename "$installer")#" > "$installer.sha256"
echo "$installer"