mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-17 22:29:38 +00:00
100 lines
3.2 KiB
YAML
100 lines
3.2 KiB
YAML
name: Build macOS
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Clean up caches
|
|
run: |
|
|
npm cache clean --force
|
|
rm -rf ~/Library/Caches/electron-builder
|
|
working-directory: simpliplay
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
working-directory: simpliplay
|
|
|
|
- name: Package all app bundles without signing
|
|
run: npx electron-builder --dir --mac --x64 --arm64 --universal
|
|
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 ---
|
|
create_dmg() {
|
|
local app_path="$1"
|
|
local dmg_name="$2"
|
|
local volume_name="$3"
|
|
|
|
# Calculate the size of the app bundle in KB, then add a 50MB buffer
|
|
APP_SIZE_KB=$(du -sk "$app_path" | cut -f1)
|
|
DMG_SIZE_MB=$(( ($APP_SIZE_KB / 1024) + 50 ))
|
|
|
|
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
|
|
hdiutil detach "$MOUNT_PATH"
|
|
}
|
|
|
|
# --- Create DMG for each architecture ---
|
|
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-universal/SimpliPlay.app" "dist/SimpliPlay-universal-darwin.dmg" "SimpliPlay Universal"
|
|
|
|
working-directory: simpliplay
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: builds
|
|
path: simpliplay/dist/*.dmg
|