diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80f33e8..1c71a59 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -222,8 +222,11 @@ jobs: APP_DIR="build/macos/Build/Products/Release-production" mv "$APP_DIR/fladder.app" "$APP_DIR/Fladder.app" - - name: Create DMG file - run: hdiutil create -format UDZO -srcfolder build/macos/Build/Products/Release-production/Fladder.app build/macos/Build/Products/Release-production/macOS.dmg + - name: Install create-dmg + run: brew install create-dmg + + - name: Create DMG with custom background + run: ./scripts/create_dmg.sh - name: Archive macOS artifact uses: actions/upload-artifact@v4.0.0 diff --git a/.gitignore b/.gitignore index 34c98af..ae927e8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ *.swp .DS_Store .atom/ +.build/ +.dmg_temp/ .buildlog/ .history .svn/ diff --git a/scripts/create_dmg.sh b/scripts/create_dmg.sh new file mode 100755 index 0000000..e664d38 --- /dev/null +++ b/scripts/create_dmg.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Script to create DMG for Fladder macOS app using create-dmg +# Usage: ./create_dmg.sh + +set -e + +# Configuration +APP_NAME="Fladder" +APP_PATH="build/macos/Build/Products/Release-production/Fladder.app" +DMG_PATH="build/macos/Build/Products/Release-production/macOS.dmg" +BACKGROUND_IMAGE="assets/macos-dmg/Fladder-DMG-Background.jpg" +TEMP_DMG_DIR="dmg_temp" + +# Check if app exists +if [ ! -d "$APP_PATH" ]; then + echo "Error: App not found at $APP_PATH" + echo "Please build the app first with: flutter build macos --flavor production" + exit 1 +fi + +# Check if background image exists +if [ ! -f "$BACKGROUND_IMAGE" ]; then + echo "Error: Background image not found at $BACKGROUND_IMAGE" + exit 1 +fi + +# Clean up any existing artifacts +rm -rf "$TEMP_DMG_DIR" +rm -f "$DMG_PATH" + +echo "Creating DMG for $APP_NAME with custom background..." + +# Create temporary directory structure for DMG +mkdir -p "$TEMP_DMG_DIR" +cp -R "$APP_PATH" "$TEMP_DMG_DIR/" + +# Create DMG with create-dmg using enhanced settings +create-dmg \ + --volname "$APP_NAME" \ + --volicon "$APP_PATH/Contents/Resources/AppIcon.icns" \ + --background "$BACKGROUND_IMAGE" \ + --window-pos 200 120 \ + --window-size 800 500 \ + --icon-size 80 \ + --icon "$APP_NAME.app" 210 250 \ + --hide-extension "$APP_NAME.app" \ + --app-drop-link 603 250 \ + --format UDZO \ + --hdiutil-quiet \ + "$DMG_PATH" \ + "$TEMP_DMG_DIR" + +# Clean up temp directory +rm -rf "$TEMP_DMG_DIR" + +echo "DMG created successfully at: $DMG_PATH" + +# Verify the DMG was created +if [ -f "$DMG_PATH" ]; then + echo "DMG file size: $(du -h "$DMG_PATH" | cut -f1)" + echo "You can test the DMG by opening: $DMG_PATH" +else + echo "ERROR: DMG creation failed!" + exit 1 +fi