mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-17 22:29:38 +00:00
Update build-macos.yml
This commit is contained in:
parent
18f25c5ef4
commit
9e73bffd51
102
.github/workflows/build-macos.yml
vendored
102
.github/workflows/build-macos.yml
vendored
@ -29,71 +29,59 @@ jobs:
|
|||||||
run: npm install
|
run: npm install
|
||||||
working-directory: simpliplay
|
working-directory: simpliplay
|
||||||
|
|
||||||
- name: Package all app bundles without signing
|
# This step creates the DMG with its UI for all three architectures.
|
||||||
run: npx electron-builder --dir --mac --x64 --arm64 --universal
|
# By default, it creates them as read/write sparse images.
|
||||||
|
- name: Package all app bundles into DMGs
|
||||||
|
run: npx electron-builder --mac --x64 --arm64 --universal
|
||||||
working-directory: simpliplay
|
working-directory: simpliplay
|
||||||
|
|
||||||
- name: Force ad-hoc signing on all app bundles
|
|
||||||
run: |
|
|
||||||
X64_APP_PATH="dist/mac/SimpliPlay.app"
|
|
||||||
ARM64_APP_PATH="dist/mac-arm64/SimpliPlay.app"
|
|
||||||
UNIVERSAL_APP_PATH="dist/mac-universal/SimpliPlay.app"
|
|
||||||
|
|
||||||
echo "Signing x64 app bundle..."
|
|
||||||
codesign --force --deep --sign - "$X64_APP_PATH"
|
|
||||||
|
|
||||||
echo "Signing arm64 app bundle..."
|
|
||||||
codesign --force --deep --sign - "$ARM64_APP_PATH"
|
|
||||||
|
|
||||||
echo "Signing universal app bundle..."
|
|
||||||
codesign --force --deep --sign - "$UNIVERSAL_APP_PATH"
|
|
||||||
|
|
||||||
echo "Ad-hoc signing complete for all bundles."
|
|
||||||
working-directory: simpliplay
|
|
||||||
|
|
||||||
- name: Create basic DMG installers
|
|
||||||
run: |
|
|
||||||
# --- Set up variables ---
|
|
||||||
APP_NAME="SimpliPlay"
|
|
||||||
|
|
||||||
# --- Function to create a DMG from a signed app bundle ---
|
# This is the key step that signs and converts all three DMGs.
|
||||||
create_dmg() {
|
- name: Sign and convert all DMGs
|
||||||
local app_path="$1"
|
run: |
|
||||||
local dmg_name="$2"
|
# Get a list of all generated DMGs
|
||||||
local volume_name="$3"
|
DMGS=$(find dist -name "*.dmg" -print)
|
||||||
|
|
||||||
# Calculate the size of the app bundle in KB, then add a 50MB buffer
|
# Loop through each DMG file
|
||||||
APP_SIZE_KB=$(du -sk "$app_path" | cut -f1)
|
for DMG_PATH in $DMGS; do
|
||||||
DMG_SIZE_MB=$(( ($APP_SIZE_KB / 1024) + 50 ))
|
echo "Processing $DMG_PATH"
|
||||||
|
|
||||||
|
# Extract the DMG name (e.g., SimpliPlay.dmg)
|
||||||
|
DMG_BASENAME=$(basename "$DMG_PATH")
|
||||||
|
|
||||||
|
# The mount point needs to be unique for each DMG.
|
||||||
|
MOUNT_PATH="/Volumes/${DMG_BASENAME%.*}"
|
||||||
|
|
||||||
|
echo "Mounting DMG: $DMG_PATH"
|
||||||
|
hdiutil attach "$DMG_PATH" -mountpoint "$MOUNT_PATH"
|
||||||
|
|
||||||
|
# The app bundle path inside the DMG
|
||||||
|
APP_PATH="$MOUNT_PATH/SimpliPlay.app"
|
||||||
|
|
||||||
|
if [ -d "$APP_PATH" ]; then
|
||||||
|
# Force ad-hoc signing on the app bundle inside the mounted DMG
|
||||||
|
echo "Ad-hoc signing app bundle inside the mounted DMG..."
|
||||||
|
codesign --force --deep --sign - "$APP_PATH"
|
||||||
|
else
|
||||||
|
echo "Error: Could not find app bundle at $APP_PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Calculated DMG size: ${DMG_SIZE_MB}MB"
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
# Mount the newly created DMG
|
|
||||||
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
|
# Unmount the DMG
|
||||||
|
echo "Unmounting DMG..."
|
||||||
hdiutil detach "$MOUNT_PATH"
|
hdiutil detach "$MOUNT_PATH"
|
||||||
}
|
|
||||||
|
# Define the final output path
|
||||||
# --- Create DMG for each architecture ---
|
FINAL_DMG_PATH="dist/$(basename "${DMG_PATH%.*}")-signed.dmg"
|
||||||
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"
|
# Convert the read/write DMG to a final, compressed, read-only DMG.
|
||||||
create_dmg "dist/mac-universal/SimpliPlay.app" "dist/SimpliPlay-universal-darwin.dmg" "SimpliPlay Universal"
|
echo "Converting to compressed, read-only DMG: $FINAL_DMG_PATH"
|
||||||
|
hdiutil convert "$DMG_PATH" -format UDZO -o "$FINAL_DMG_PATH"
|
||||||
|
done
|
||||||
working-directory: simpliplay
|
working-directory: simpliplay
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: builds
|
name: builds
|
||||||
path: simpliplay/dist/*.dmg
|
# Upload only the final signed DMGs
|
||||||
|
path: simpliplay/dist/*-signed.dmg
|
||||||
|
Loading…
Reference in New Issue
Block a user