Attempt to make file sizes smaller

This commit is contained in:
Anirudh Sevugan 2025-08-08 16:33:17 -05:00 committed by GitHub
parent 791761fd8f
commit 05bb059b41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,25 +62,34 @@ jobs:
local dmg_name="$2" local dmg_name="$2"
local volume_name="$3" local volume_name="$3"
# Create a temporary directory to build DMG contents # Calculate the size of the app bundle in KB, then add a buffer (e.g., 50MB)
local temp_dir="dmg_contents" APP_SIZE_KB=$(du -sk "$app_path" | cut -f1)
mkdir "$temp_dir" DMG_SIZE_MB=$(( ($APP_SIZE_KB / 1024) + 5 ))
# Copy the app bundle and create the symlink echo "Calculated DMG size: ${DMG_SIZE_MB}MB"
cp -r "$app_path" "$temp_dir/"
ln -s /Applications "$temp_dir/Applications"
# Create the DMG from the temporary directory # Create a new, empty APFS DMG with the specified volume name and calculated size
hdiutil create -volname "$volume_name" -srcfolder "$temp_dir" -fs APFS -ov "$dmg_name" hdiutil create -fs APFS -size "${DMG_SIZE_MB}m" -volname "$volume_name" -ov "$dmg_name"
# Clean up the temporary directory # Mount the newly created DMG
rm -r "$temp_dir" MOUNT_PATH="/Volumes/$volume_name"
hdiutil attach "$dmg_name" -mountpoint "$MOUNT_PATH"
# Copy the app bundle into the mounted DMG
cp -r "$app_path" "$MOUNT_PATH/"
# Create the symlink to /Applications inside the mounted DMG
ln -s /Applications "$MOUNT_PATH/Applications"
# Unmount the DMG
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"
create_dmg "dist/mac-universal/SimpliPlay.app" "dist/SimpliPlay-universal-darwin.dmg" "SimpliPlay Universal" create_dmg "dist/mac-universal/SimpliPlay.app" "dist/SimpliPlay-universal-darwin.dmg" "SimpliPlay Universal"
working-directory: simpliplay working-directory: simpliplay
- name: Upload artifacts - name: Upload artifacts