|
6 | 6 | # the bug doesn't exist, but the styled DMG stays as industry-standard UX |
7 | 7 | # (see Slack, Chrome, Notion — all do this). |
8 | 8 | # |
9 | | -# Expected input: artifacts/mac-arm64/Skiller.app (from `electron-builder --mac` |
10 | | -# with mac.target = dir). |
11 | | -# Output: artifacts/Skiller-<version>-macos-arm64.dmg — signed, notarized, |
| 9 | +# Expected input: artifacts/mac-<arch>/Skiller.app (from `electron-builder --mac` |
| 10 | +# with mac.target = dir). Pass the target arch as the first arg: arm64 or x64. |
| 11 | +# Defaults to the host arch for backwards compat with local one-shot runs. |
| 12 | +# Output: artifacts/Skiller-<version>-macos-<arch>.dmg — signed, notarized, |
12 | 13 | # stapled. |
13 | 14 | # |
14 | 15 | # Requires: create-dmg (brew install create-dmg), xcrun, codesign. |
15 | 16 | set -euo pipefail |
16 | 17 |
|
17 | 18 | ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" |
18 | | -ARCH="$(uname -m)" |
| 19 | + |
| 20 | +# Normalize: accept arm64|x64 as input; the DMG filename uses that, and |
| 21 | +# electron-builder's output dir uses the same tokens (mac-arm64, mac-x64) |
| 22 | +# when multiple arches are built in one invocation. When only one arch is |
| 23 | +# built, electron-builder drops the suffix (just `mac/`) — handle that too. |
| 24 | +RAW_ARCH="${1:-$(uname -m)}" |
| 25 | +case "$RAW_ARCH" in |
| 26 | + arm64|aarch64) ARCH="arm64" ;; |
| 27 | + x64|x86_64|amd64) ARCH="x64" ;; |
| 28 | + *) echo "error: unknown arch '$RAW_ARCH'" >&2; exit 1 ;; |
| 29 | +esac |
| 30 | + |
19 | 31 | BUILD_DIR="$ROOT_DIR/artifacts/mac-${ARCH}" |
| 32 | +if [[ ! -d "$BUILD_DIR" && -d "$ROOT_DIR/artifacts/mac" ]]; then |
| 33 | + BUILD_DIR="$ROOT_DIR/artifacts/mac" |
| 34 | +fi |
20 | 35 | APP_PATH="$BUILD_DIR/Skiller.app" |
21 | 36 | BG_IMG="$ROOT_DIR/assets/dmg/background.png" |
22 | 37 | APP_ICON="$ROOT_DIR/assets/icons/app.icns" |
|
0 commit comments