Skip to content

fix: Mac DMG Release Build#49

Merged
duartebarbosadev merged 4 commits intomainfrom
fix-release-build-action-mac-fix
Oct 8, 2025
Merged

fix: Mac DMG Release Build#49
duartebarbosadev merged 4 commits intomainfrom
fix-release-build-action-mac-fix

Conversation

@duartebarbosadev
Copy link
Copy Markdown
Owner

This pull request improves the consistency, reliability, and professionalism of the release build process for both Windows and macOS in the .github/workflows/release-build.yml workflow. The main changes include always regenerating the macOS icon file, updating image resizing for compatibility, adding automated validation steps for build artifacts, enhancing DMG packaging for macOS, and flattening the artifact directory for cleaner releases.

Build consistency and compatibility:

  • Always regenerate the .icns icon file in CI for macOS builds to avoid inconsistencies caused by stale assets.
  • Update the Pillow image resizing API to use Image.Resampling.LANCZOS for compatibility with newer versions.

Automated artifact validation:

  • Add a smoke test for the Windows executable to check for existence, size, and a valid PE header.
  • Add a validation step for the macOS app bundle to check for required files, executable permissions, and display the bundle size.

Release packaging improvements:

  • Switch to using create-dmg for macOS DMG creation, ensuring a professional appearance and reliable artifact naming, with additional checks for DMG existence and cleanup of staging files.
  • Flatten the artifact directory before release to ensure only the necessary files (.exe, .dmg, .sha256) are attached to the GitHub release, simplifying the release structure.

Copilot AI review requested due to automatic review settings October 8, 2025 01:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the CI workflow with improved build consistency, automated validation, and professional DMG creation for both Windows and macOS releases. The changes focus on making the release process more reliable and generating cleaner artifacts.

  • Always regenerate macOS icon files in CI for consistency and update image resizing API for newer Pillow versions
  • Add automated validation steps for Windows executables (PE header check) and macOS app bundles (structure and permissions)
  • Replace basic hdiutil with create-dmg for professional macOS DMG packaging and flatten artifact directory structure for cleaner releases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

fi
iconutil -c icns build/icons/PhotoSort.iconset -o assets/photosort.icns
fi

Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra 'fi' statement on line 127 will cause a syntax error since there's no corresponding 'if' statement. This line should be removed.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +282 to +283
"$STAGING_DIR" \
|| true # create-dmg exits with 2 on success sometimes
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using || true to ignore all exit codes masks potential real failures. Consider checking for specific expected exit codes (like 2) instead of ignoring all failures.

Suggested change
"$STAGING_DIR" \
|| true # create-dmg exits with 2 on success sometimes
"$STAGING_DIR"
# create-dmg exits with 2 on success sometimes; fail for other codes
status=$?
if [ "$status" -ne 0 ] && [ "$status" -ne 2 ]; then
echo "create-dmg failed with exit code $status" >&2
exit $status
fi

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

iconutil -c icns build/icons/PhotoSort.iconset -o assets/photosort.icns
fi
iconutil -c icns build/icons/PhotoSort.iconset -o assets/photosort.icns
fi
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'fi' statement is orphaned after removing the conditional check. This will cause a shell syntax error.

Copilot uses AI. Check for mistakes.
Comment on lines +300 to +301
"$STAGING_DIR" \
|| true # create-dmg exits with 2 on success sometimes
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using || true to suppress exit codes can mask real failures. Consider checking the specific exit code (2) that indicates success instead of ignoring all errors.

Suggested change
"$STAGING_DIR" \
|| true # create-dmg exits with 2 on success sometimes
"$STAGING_DIR"
status=$?
if [ "$status" -ne 0 ] && [ "$status" -ne 2 ]; then
echo "create-dmg failed with exit code $status" >&2
exit $status
fi

Copilot uses AI. Check for mistakes.
@duartebarbosadev duartebarbosadev changed the title feat: Enhance CI workflow with app validation and improved DMG creation fix: Mac DMG Release Build Oct 8, 2025
@duartebarbosadev duartebarbosadev merged commit 907fd02 into main Oct 8, 2025
3 checks passed
@duartebarbosadev duartebarbosadev deleted the fix-release-build-action-mac-fix branch October 8, 2025 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants