diff --git a/.github/assets/maid.dmg b/.github/assets/maid.dmg deleted file mode 100644 index 902a9737..00000000 Binary files a/.github/assets/maid.dmg and /dev/null differ diff --git a/.github/scripts/create_dmg.sh b/.github/scripts/create_dmg.sh index e92e9fac..65416e81 100755 --- a/.github/scripts/create_dmg.sh +++ b/.github/scripts/create_dmg.sh @@ -4,33 +4,112 @@ set -e APP_NAME="maid" APP_DIR="build/macos/Build/Products/Release/${APP_NAME}.app" -DMG_TEMPLATE="./.github/assets/maid.dmg" -DMG_OUTPUT="./dmg/${APP_NAME}.dmg" +DMG_DIR="dmg" TMP_MOUNT="/tmp/Maid" -TMP_DMG="/tmp/${APP_NAME}_tmp.dmg" -DMG_SIZE=1g +DMG_BACKGROUND_IMG="./media/dmg.png" +WINX=0 +WINY=0 +WINW=700 +WINH=1000 +ICON_SIZE=64 +TEXT_SIZE=12 -# Create the dmg directory if it does not exist -mkdir -p "$(dirname ${DMG_OUTPUT})" +# Create the dmg and app directories if they do not exist +mkdir -p ${DMG_DIR} mkdir -p ${TMP_MOUNT} -# Create a new writable DMG with the specified size -hdiutil create -srcfolder ${DMG_TEMPLATE} -volname "${APP_NAME}" -format UDRW -size ${DMG_SIZE} ${TMP_DMG} +# Create temporary DMG +hdiutil create ${DMG_DIR}/${APP_NAME}_tmp.dmg -volname "${APP_NAME}" -srcfolder "${APP_DIR}" -ov -format UDRW -# Mount the writable DMG -hdiutil attach ${TMP_DMG}.dmg -mountpoint ${TMP_MOUNT} -nobrowse -noverify -noautoopen +# Mount the temporary DMG +hdiutil attach ${DMG_DIR}/${APP_NAME}_tmp.dmg -mountpoint ${TMP_MOUNT} -# Replace the TARGET file with maid.app -rm -rf "${TMP_MOUNT}/TARGET" -cp -R "${APP_DIR}" "${TMP_MOUNT}/maid.app" +# Copy background image +mkdir -p ${TMP_MOUNT}/.background +cp ${DMG_BACKGROUND_IMG} ${TMP_MOUNT}/.background/feature.png -# Unmount the writable DMG +# Create a symbolic link to the Applications folder +ln -s /Applications ${TMP_MOUNT}/Applications + +# AppleScript to set DMG properties +osascript <