diff --git a/.github/scripts/create_dmg.sh b/.github/scripts/create_dmg.sh index e1f4b061..7444b27c 100755 --- a/.github/scripts/create_dmg.sh +++ b/.github/scripts/create_dmg.sh @@ -7,22 +7,29 @@ APP_DIR="build/macos/Build/Products/Release/${APP_NAME}.app" DMG_TEMPLATE="./.github/assets/maid.dmg" DMG_OUTPUT="./dmg/${APP_NAME}.dmg" TMP_MOUNT="/tmp/Maid" +TMP_DMG="/tmp/${APP_NAME}_tmp.dmg" # Create the dmg directory if it does not exist mkdir -p "$(dirname ${DMG_OUTPUT})" mkdir -p ${TMP_MOUNT} -# Mount the template DMG -hdiutil attach ${DMG_TEMPLATE} -mountpoint ${TMP_MOUNT} -nobrowse -noverify -noautoopen +# Convert the template DMG to a writable DMG +hdiutil convert ${DMG_TEMPLATE} -format UDRW -o ${TMP_DMG} + +# Mount the writable DMG +hdiutil attach ${TMP_DMG} -mountpoint ${TMP_MOUNT} -nobrowse -noverify -noautoopen # Replace the TARGET file with maid.app rm -rf "${TMP_MOUNT}/TARGET" cp -R "${APP_DIR}" "${TMP_MOUNT}/maid.app" -# Unmount the template DMG +# Unmount the writable DMG hdiutil detach ${TMP_MOUNT} -# Create the final DMG from the modified template -hdiutil convert ${DMG_TEMPLATE} -format UDZO -o ${DMG_OUTPUT} +# Convert the writable DMG to a compressed DMG +hdiutil convert ${TMP_DMG} -format UDZO -o ${DMG_OUTPUT} + +# Clean up the temporary writable DMG +rm ${TMP_DMG} echo "DMG creation completed successfully!"