Skip to content

Commit 7a2ad8a

Browse files
committed
improve packaging step and add dmg/tar output
1 parent b8c3c17 commit 7a2ad8a

1 file changed

Lines changed: 30 additions & 20 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -376,42 +376,52 @@ jobs:
376376
--self-contained true \
377377
--output ../bin/${{ matrix.name }}
378378
379+
- name: Install macOS packaging tools
380+
if: runner.os == 'macOS'
381+
run: brew install create-dmg
382+
379383
- name: Package (macOS)
380384
if: runner.os == 'macOS'
381385
run: |
386+
set -euo pipefail
382387
VERSION='${{ needs.preflight.outputs.package-version }}'
383-
mkdir -p output
384-
385-
# Build .app bundle — macOS requires Contents/MacOS/<executable> + Info.plist
386388
APP_BUNDLE="UniGetUI.app"
389+
APP_EXECUTABLE="UniGetUI.Avalonia"
390+
391+
rm -rf "${APP_BUNDLE}" output
392+
mkdir -p output
387393
mkdir -p "${APP_BUNDLE}/Contents/MacOS"
388-
cp -R bin/${{ matrix.name }}/. "${APP_BUNDLE}/Contents/MacOS/"
389-
chmod +x "${APP_BUNDLE}/Contents/MacOS/UniGetUI.Avalonia"
394+
mkdir -p "${APP_BUNDLE}/Contents/Resources"
395+
396+
cp -R "bin/${{ matrix.name }}/." "${APP_BUNDLE}/Contents/MacOS/"
397+
chmod +x "${APP_BUNDLE}/Contents/MacOS/${APP_EXECUTABLE}"
390398
sed "s|@VERSION@|${VERSION}|g" \
391399
scripts/macos/Info.plist \
392400
> "${APP_BUNDLE}/Contents/Info.plist"
393-
mkdir -p "${APP_BUNDLE}/Contents/Resources"
394401
cp scripts/macos/UniGetUI.icns "${APP_BUNDLE}/Contents/Resources/"
395402
403+
# Temporary ad-hoc signing only; proper Developer ID signing/notarization comes later.
396404
find "${APP_BUNDLE}/Contents/MacOS" -type f | while IFS= read -r f; do
397405
codesign --force --sign - "$f" 2>/dev/null || true
398406
done
399407
codesign --force --sign - "${APP_BUNDLE}"
400408
401-
# .tar.gz — archive the .app bundle
402-
tar -czf output/UniGetUI.${{ matrix.name }}.tar.gz "${APP_BUNDLE}"
403-
404-
# .dmg — stage the .app bundle, then convert to a compressed read-only image
405-
DMG_STAGING=$(mktemp -d)
406-
trap "rm -rf '$DMG_STAGING'" EXIT
407-
cp -R "${APP_BUNDLE}" "$DMG_STAGING/"
408-
ln -s /Applications "$DMG_STAGING/Applications"
409-
hdiutil create \
410-
-volname "UniGetUI" \
411-
-srcfolder "$DMG_STAGING" \
412-
-ov \
413-
-format UDZO \
414-
output/UniGetUI.${{ matrix.name }}.dmg
409+
COPYFILE_DISABLE=1 tar -czf "output/UniGetUI.${{ matrix.name }}.tar.gz" "${APP_BUNDLE}"
410+
411+
create-dmg \
412+
--volname "UniGetUI" \
413+
--volicon "scripts/macos/UniGetUI.icns" \
414+
--window-pos 200 120 \
415+
--window-size 600 400 \
416+
--icon-size 128 \
417+
--icon "UniGetUI.app" 150 185 \
418+
--hide-extension "UniGetUI.app" \
419+
--app-drop-link 450 185 \
420+
"output/UniGetUI.${{ matrix.name }}.dmg" \
421+
"${APP_BUNDLE}"
422+
423+
test -f "output/UniGetUI.${{ matrix.name }}.tar.gz"
424+
test -f "output/UniGetUI.${{ matrix.name }}.dmg"
415425
416426
- name: Install Linux packaging tools
417427
if: runner.os == 'Linux'

0 commit comments

Comments
 (0)