Update build-macos.yml

This commit is contained in:
Anirudh Sevugan 2025-08-08 16:36:21 -05:00 committed by GitHub
parent 05bb059b41
commit 18f25c5ef4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,36 +55,36 @@ jobs:
run: | run: |
# --- Set up variables --- # --- Set up variables ---
APP_NAME="SimpliPlay" APP_NAME="SimpliPlay"
# --- Function to create a DMG from a signed app bundle --- # --- Function to create a DMG from a signed app bundle ---
create_dmg() { create_dmg() {
local app_path="$1" local app_path="$1"
local dmg_name="$2" local dmg_name="$2"
local volume_name="$3" local volume_name="$3"
# Calculate the size of the app bundle in KB, then add a buffer (e.g., 50MB) # Calculate the size of the app bundle in KB, then add a 50MB buffer
APP_SIZE_KB=$(du -sk "$app_path" | cut -f1) APP_SIZE_KB=$(du -sk "$app_path" | cut -f1)
DMG_SIZE_MB=$(( ($APP_SIZE_KB / 1024) + 5 )) DMG_SIZE_MB=$(( ($APP_SIZE_KB / 1024) + 50 ))
echo "Calculated DMG size: ${DMG_SIZE_MB}MB" echo "Calculated DMG size: ${DMG_SIZE_MB}MB"
# Create a new, empty APFS DMG with the specified volume name and calculated size # Create a new, empty APFS DMG with the specified volume name and calculated size
hdiutil create -fs APFS -size "${DMG_SIZE_MB}m" -volname "$volume_name" -ov "$dmg_name" hdiutil create -fs APFS -size "${DMG_SIZE_MB}m" -volname "$volume_name" -ov "$dmg_name"
# Mount the newly created DMG # Mount the newly created DMG
MOUNT_PATH="/Volumes/$volume_name" MOUNT_PATH="/Volumes/$volume_name"
hdiutil attach "$dmg_name" -mountpoint "$MOUNT_PATH" hdiutil attach "$dmg_name" -mountpoint "$MOUNT_PATH"
# Copy the app bundle into the mounted DMG # Copy the app bundle into the mounted DMG
cp -r "$app_path" "$MOUNT_PATH/" cp -r "$app_path" "$MOUNT_PATH/"
# Create the symlink to /Applications inside the mounted DMG # Create the symlink to /Applications inside the mounted DMG
ln -s /Applications "$MOUNT_PATH/Applications" ln -s /Applications "$MOUNT_PATH/Applications"
# Unmount the DMG # Unmount the DMG
hdiutil detach "$MOUNT_PATH" hdiutil detach "$MOUNT_PATH"
} }
# --- Create DMG for each architecture --- # --- Create DMG for each architecture ---
create_dmg "dist/mac/SimpliPlay.app" "dist/SimpliPlay-x64-darwin.dmg" "SimpliPlay x64" create_dmg "dist/mac/SimpliPlay.app" "dist/SimpliPlay-x64-darwin.dmg" "SimpliPlay x64"
create_dmg "dist/mac-arm64/SimpliPlay.app" "dist/SimpliPlay-arm64-darwin.dmg" "SimpliPlay arm64" create_dmg "dist/mac-arm64/SimpliPlay.app" "dist/SimpliPlay-arm64-darwin.dmg" "SimpliPlay arm64"