Skip to content

fix(release): rebuild DMG from scratch via bundle_dmg.sh (supersedes #952/#955)#957

Merged
senamakel merged 2 commits into
tinyhumansai:mainfrom
senamakel:fix/dmg-rebuild-from-scratch
Apr 27, 2026
Merged

fix(release): rebuild DMG from scratch via bundle_dmg.sh (supersedes #952/#955)#957
senamakel merged 2 commits into
tinyhumansai:mainfrom
senamakel:fix/dmg-rebuild-from-scratch

Conversation

@senamakel
Copy link
Copy Markdown
Member

@senamakel senamakel commented Apr 27, 2026

Summary

Stops trying to mount-and-modify the Tauri-built DMG after notarization, and instead rebuilds it from scratch using the same bundle_dmg.sh Tauri itself uses. The mount-and-modify approach (and every variant we tried — retry loop, temp output path, hdiutil compact) fails consistently on macOS 26.x runners with:

Preparing imaging engine…
hdiutil: convert failed - internal error

after UDZO → UDRW → modify → UDZO. The failure is structural in current hdiutil — modifying a converted UDRW and re-compressing it to UDZO is broken. Tauri's own bundle_dmg.sh builds a fresh UDRW from a source folder via hdiutil create -srcfolder and then converts to UDZO, which works fine.

Approach

  • Tauri leaves <bundle_dir>/dmg/bundle_dmg.sh and <bundle_dir>/share/create-dmg/support/ on disk after the original bundle pass. Reuse them.
  • Run bundle_dmg.sh against the (now-notarized) <bundle_dir>/macos/OpenHuman.app with the same defaults Tauri passes (--volname OpenHuman, --icon OpenHuman.app 180 170, --app-drop-link 480 170, --window-size 660 400, --background images/background-dmg.png, --skip-jenkins).
  • Output replaces the original DMG at <bundle_dir>/dmg/<NAME>.dmg.
  • Stage the .app into MACOS_DIR if the caller passed it from elsewhere, so the source folder always contains the right (notarized) bundle.
  • Pre-clean any leftover rw.*.dmg scratch files; resolve every path absolute so the cd-then-invoke flow doesn't break.
  • Notarization, log-fetch-on-failure, stapling, and final mount/layout verification logic preserved.

Test plan

  • Local end-to-end run against OpenHuman.app from the debug bundle: bundle_dmg.sh produced a 176M UDZO DMG, Apple notary returned status: Accepted, issues: null, xcrun stapler staple succeeded, mount verification confirmed OpenHuman.app + Applications symlink present.
  • Dispatch a staging release on GitHub Actions; confirm Re-package DMG after notarization succeeds and the resulting DMG has the expected layout.

Supersedes

Reference failing run: https://github.com/tinyhumansai/openhuman/actions/runs/24970255766/job/73111881422

Summary by CodeRabbit

  • Chores
    • Optimized the macOS disk image creation process to enhance build reliability.

…zation

Replaces the round-trip-then-modify approach in repackage-dmg.sh, which
fails consistently on macOS 26.x runners with `hdiutil: convert failed
- internal error` when re-compressing a UDZO→UDRW→modified→UDZO image.
Earlier attempts (retry loop, temp output path, hdiutil compact) did not
help — the failure is structural in current hdiutil.

Tauri's own bundle_dmg.sh builds a fresh UDRW from a source folder via
`hdiutil create -srcfolder` and then converts to UDZO; that path works.

- Reuse `<bundle_dir>/dmg/bundle_dmg.sh` (left on disk by tauri-build)
  with the same volname / icon positions / window size / background
  defaults Tauri uses, packaging the now-notarized .app from
  `<bundle_dir>/macos/`.
- Stage a non-local .app into MACOS_DIR (handles the case where the
  caller passes the .app from somewhere else than the bundle layout).
- Resolve every bundle path absolute so the cd-then-invoke flow doesn't
  break. Pre-clean any leftover `rw.*.dmg` scratch files.
- Notarization, log-fetch-on-failure, stapling, and final mount/layout
  verification logic preserved.

Verified locally end-to-end against `OpenHuman.app` from the debug
bundle: bundle_dmg.sh produced a 176M UDZO DMG, Apple notary returned
status: Accepted, issues: null, stapler succeeded, mount verification
confirmed OpenHuman.app + Applications symlink present.

Reference failing CI run that motivated this rewrite:
https://github.com/tinyhumansai/openhuman/actions/runs/24970255766/job/73111881422
@senamakel senamakel requested a review from a team April 27, 2026 02:16
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e55ddaf4-600b-4aac-9608-b550eab7ce3e

📥 Commits

Reviewing files that changed from the base of the PR and between e3c46d1 and 91af806.

📒 Files selected for processing (1)
  • scripts/release/repackage-dmg.sh

📝 Walkthrough

Walkthrough

The DMG re-packaging flow transitions from modifying an existing Tauri-built UDZO image in-place to rebuilding the DMG from scratch using Tauri's vendored bundle_dmg.sh. The script now resolves paths, validates files, stages the notarized .app, optionally injects background images, executes the bundle script, and notarizes the rebuilt DMG.

Changes

Cohort / File(s) Summary
DMG Repackaging Logic Rewrite
scripts/release/repackage-dmg.sh
Replaces in-place UDZO conversion (UDZO→UDRW→mount→replace→resize→UDZO) with scratch rebuild via bundle_dmg.sh. Adds bundle path resolution, file/directory validation, staged .app placement into $bundle_dir/macos/<AppName>, optional DMG background image injection, and notarization of the rebuilt DMG. Updates cleanup to remove rw.*.dmg scratch artifacts and adjusts error output to reference $APP_NAME and write to stderr.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 A bundle rebuilt from scratch so fine,
No UDZO quirks shall make us pine,
With bundle_dmg.sh we leap and bound,
A cleaner path for DMGs found!
Notarized and stapled with care,

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@senamakel senamakel merged commit 36f2f2f into tinyhumansai:main Apr 27, 2026
8 checks passed
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.

1 participant