Skip to content

Commit 9e65f31

Browse files
committed
fix: create macos dmg when app bundle is built alone
1 parent c8540b7 commit 9e65f31

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

scripts/desktop/notarize_macos.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ DMG_PATH=""
3939
if [[ -n "$BUNDLE_DIR" ]]; then
4040
APP_PATH="$(find "$BUNDLE_DIR/macos" -maxdepth 1 -name "*.app" -type d | head -n1 || true)"
4141
DMG_PATH="$(find "$BUNDLE_DIR/dmg" -maxdepth 1 -name "*.dmg" -type f | head -n1 || true)"
42+
if [[ -z "$DMG_PATH" && -n "$APP_PATH" ]]; then
43+
mkdir -p "$BUNDLE_DIR/dmg"
44+
DMG_PATH="$BUNDLE_DIR/dmg/$(basename "${APP_PATH%.app}").dmg"
45+
fi
4246
fi
4347

4448
extract_notary_field() {

scripts/test/notarize_macos_test.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,23 @@ assert_contains "$log_native" "--icon AI Gate.app 170 275"
263263
assert_contains "$log_native" "--app-drop-link 630 275"
264264
assert_not_contains "$log_native" "No macOS app bundle found"
265265

266+
repo_no_dmg="$tmp_dir/repo-no-dmg"
267+
bin_no_dmg="$tmp_dir/bin-no-dmg"
268+
log_no_dmg="$tmp_dir/no-dmg.log"
269+
make_repo "$repo_no_dmg"
270+
make_fake_bin "$bin_no_dmg"
271+
make_fake_bundle_dmg_script "$repo_no_dmg"
272+
rm -f "$repo_no_dmg/desktop/src-tauri/target/universal-apple-darwin/release/bundle/dmg/AI Gate.dmg"
273+
274+
(
275+
cd "$repo_no_dmg"
276+
CALL_LOG="$log_no_dmg" \
277+
PATH="$bin_no_dmg:$PATH" \
278+
bash scripts/desktop/notarize_macos.sh
279+
)
280+
281+
assert_contains "$log_no_dmg" "bundle_dmg:--volname AI Gate Installer --background"
282+
assert_contains "$log_no_dmg" "$repo_no_dmg/desktop/src-tauri/target/universal-apple-darwin/release/bundle/dmg/AI Gate.dmg"
283+
assert_not_contains "$log_no_dmg" "No dmg found, create zip for notarization"
284+
266285
echo "PASS: notarize_macos_test"

0 commit comments

Comments
 (0)