Update build-macos.yml

This commit is contained in:
Anirudh Sevugan 2025-08-08 16:47:51 -05:00 committed by GitHub
parent 9e73bffd51
commit c97b1fa174
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,51 +29,42 @@ jobs:
run: npm install run: npm install
working-directory: simpliplay working-directory: simpliplay
# This step creates the DMG with its UI for all three architectures. # This step creates the DMG with the UI, and the app bundle inside is unsigned.
# By default, it creates them as read/write sparse images. # This is the single, simple step that handles the complex parts for you.
- name: Package all app bundles into DMGs - name: Create unsigned DMGs with UI
run: npx electron-builder --mac --x64 --arm64 --universal run: npx electron-builder --mac
working-directory: simpliplay working-directory: simpliplay
# This is the key step that signs and converts all three DMGs. # A more robust step to find, sign, and convert all DMGs.
- name: Sign and convert all DMGs - name: Sign and finalize DMGs
run: | run: |
# Get a list of all generated DMGs # Find all DMG files created by Electron Builder.
DMGS=$(find dist -name "*.dmg" -print) DMGS=$(find dist/mac -name "*.dmg" -print)
# Loop through each DMG file # Loop through each DMG file.
for DMG_PATH in $DMGS; do for DMG_PATH in $DMGS; do
echo "Processing $DMG_PATH" echo "Processing DMG: $DMG_PATH"
# Extract the DMG name (e.g., SimpliPlay.dmg) MOUNT_PATH="/Volumes/electron-builder-dmg"
DMG_BASENAME=$(basename "$DMG_PATH")
# The mount point needs to be unique for each DMG. # Attach the DMG as a read/write volume.
MOUNT_PATH="/Volumes/${DMG_BASENAME%.*}"
echo "Mounting DMG: $DMG_PATH"
hdiutil attach "$DMG_PATH" -mountpoint "$MOUNT_PATH" hdiutil attach "$DMG_PATH" -mountpoint "$MOUNT_PATH"
# The app bundle path inside the DMG # The app bundle path inside the mounted DMG.
APP_PATH="$MOUNT_PATH/SimpliPlay.app" APP_PATH="$MOUNT_PATH/SimpliPlay.app"
if [ -d "$APP_PATH" ]; then # Ad-hoc sign the app bundle.
# Force ad-hoc signing on the app bundle inside the mounted DMG echo "Signing app at $APP_PATH"
echo "Ad-hoc signing app bundle inside the mounted DMG..." codesign --force --deep --sign - "$APP_PATH"
codesign --force --deep --sign - "$APP_PATH"
else
echo "Error: Could not find app bundle at $APP_PATH"
exit 1
fi
# Unmount the DMG # Unmount the DMG.
echo "Unmounting DMG..."
hdiutil detach "$MOUNT_PATH" hdiutil detach "$MOUNT_PATH"
# Define the final output path # Get the output filename for the finalized DMG.
FINAL_DMG_PATH="dist/$(basename "${DMG_PATH%.*}")-signed.dmg" FINAL_DMG_NAME=$(basename "$DMG_PATH" .dmg)
FINAL_DMG_PATH="dist/${FINAL_DMG_NAME}-signed.dmg"
# Convert the read/write DMG to a final, compressed, read-only DMG. # Convert the read/write DMG to a read-only, compressed DMG.
echo "Converting to compressed, read-only DMG: $FINAL_DMG_PATH" echo "Converting to compressed, read-only DMG: $FINAL_DMG_PATH"
hdiutil convert "$DMG_PATH" -format UDZO -o "$FINAL_DMG_PATH" hdiutil convert "$DMG_PATH" -format UDZO -o "$FINAL_DMG_PATH"
done done
@ -83,5 +74,4 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: builds name: builds
# Upload only the final signed DMGs
path: simpliplay/dist/*-signed.dmg path: simpliplay/dist/*-signed.dmg