2026-07-17 20:10:22 +08:00
|
|
|
#!/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}"
|
2026-07-18 21:39:13 +08:00
|
|
|
target_root="${CARGO_TARGET_DIR:-$repo_root/src-tauri/target}"
|
|
|
|
|
bundle_dir="$target_root/$target/release/bundle/macos"
|
|
|
|
|
app="$bundle_dir/${HOLOLAKE_APP_NAME:-HoloLake Era}.app"
|
2026-07-17 20:10:22 +08:00
|
|
|
installer="$output_dir/HoloLake-Era-$version-Mac-internal-aarch64.dmg"
|
2026-07-18 21:39:13 +08:00
|
|
|
tauri_config="${HOLOLAKE_TAURI_CONFIG:-}"
|
|
|
|
|
if [[ -n "${HOLOLAKE_INSTALLER_BASENAME:-}" ]]; then
|
|
|
|
|
installer_basename="${HOLOLAKE_INSTALLER_BASENAME//\{version\}/$version}"
|
|
|
|
|
installer="$output_dir/${installer_basename}.dmg"
|
|
|
|
|
fi
|
2026-07-17 20:10:22 +08:00
|
|
|
|
2026-07-18 21:39:13 +08:00
|
|
|
if command -v pnpm >/dev/null 2>&1; then
|
|
|
|
|
pnpm_cmd=(pnpm)
|
|
|
|
|
elif command -v corepack >/dev/null 2>&1; then
|
|
|
|
|
pnpm_cmd=(corepack pnpm)
|
|
|
|
|
else
|
|
|
|
|
echo "pnpm or corepack is required." >&2
|
|
|
|
|
exit 2
|
|
|
|
|
fi
|
2026-07-17 20:10:22 +08:00
|
|
|
command -v hdiutil >/dev/null || { echo "hdiutil is required." >&2; exit 2; }
|
|
|
|
|
mkdir -p "$output_dir"
|
|
|
|
|
|
2026-07-18 21:39:13 +08:00
|
|
|
if [[ "${HOLOLAKE_SKIP_INSTALL:-0}" != "1" ]]; then
|
|
|
|
|
"${pnpm_cmd[@]}" install --frozen-lockfile
|
|
|
|
|
fi
|
|
|
|
|
[[ -x "$repo_root/node_modules/.bin/tauri" ]] || { echo "Local Tauri CLI is missing; install dependencies first." >&2; exit 2; }
|
|
|
|
|
tauri_args=(build --target "$target" --bundles app)
|
|
|
|
|
if [[ -n "$tauri_config" ]]; then tauri_args+=(--config "$tauri_config"); fi
|
|
|
|
|
"$repo_root/node_modules/.bin/tauri" "${tauri_args[@]}"
|
2026-07-17 20:10:22 +08:00
|
|
|
[[ -d "$app" ]] || { echo "No macOS application bundle was produced: $app" >&2; exit 1; }
|
|
|
|
|
|
2026-07-18 21:39:13 +08:00
|
|
|
node scripts/verify-internal-package-content.mjs "$app"
|
2026-07-17 20:10:22 +08:00
|
|
|
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"
|