From 7d477103e2b4a9e0f27189cb1ed77d9cb38d4afa Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Fri, 6 Nov 2020 09:33:37 -0800 Subject: Add DMG creation to macOS package script --- RELEASE.md | 8 ++++---- desktop/package/macos/build.py | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 2290b42e..32f88db7 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -132,7 +132,7 @@ Make sure your virtual environment is active: . venv/bin/activate ``` -Run the macOS build script: +Run the macOS build script (you'll need to `brew install create-dmg` first): ```sh ./package/macos/build.py --with-codesign @@ -140,11 +140,11 @@ Run the macOS build script: Now, notarize the release. You must have an app-specific Apple ID password saved in the login keychain called `onionshare-notarize`. -- Notarize it: `xcrun altool --notarize-app --primary-bundle-id "com.micahflee.onionshare" -u "micah@micahflee.com" -p "@keychain:onionshare-notarize" --file macOS/OnionShare-$VERSION.dmg` +- Notarize it: `xcrun altool --notarize-app --primary-bundle-id "com.micahflee.onionshare" -u "micah@micahflee.com" -p "@keychain:onionshare-notarize" --file macOS/OnionShare.dmg` - Wait for it to get approved, check status with: `xcrun altool --notarization-history 0 -u "micah@micahflee.com" -p "@keychain:onionshare-notarize"` -- After it's approved, staple the ticket: `xcrun stapler staple macOS/OnionShare-$VERSION.dmg` +- After it's approved, staple the ticket: `xcrun stapler staple macOS/OnionShare.dmg` -This will create `macOS/OnionShare-$VERSION.dmg`, signed and notarized. +This will create `macOS/OnionShare.dmg`, signed and notarized. ### Source package diff --git a/desktop/package/macos/build.py b/desktop/package/macos/build.py index c84e02cb..1c5e6a95 100755 --- a/desktop/package/macos/build.py +++ b/desktop/package/macos/build.py @@ -86,7 +86,43 @@ def main(): ) print(f"○ Signed app bundle: {app_path}") - print("○ TODO: Make a DMG package") + if not os.path.exists("/usr/local/bin/create-dmg"): + print("○ Error: create-dmg is not installed") + return + + print("○ Creating DMG") + dmg_path = os.path.join(desktop_dir, "macOS", "OnionShare.dmg") + run( + [ + "create-dmg", + "--volname", + "OnionShare", + "--volicon", + os.path.join( + desktop_dir, "src", "onionshare", "resources", "onionshare.icns" + ), + "--window-size", + "400", + "200", + "--icon-size", + "100", + "--icon", + "OnionShare.app", + "100", + "70", + "--hide-extension", + "OnionShare.app", + "--app-drop-link", + "300", + "70", + dmg_path, + app_path, + "--identity", + identity_name_application, + ] + ) + + print(f"○ Finished building DMG: {dmg_path}") if __name__ == "__main__": -- cgit v1.2.3-54-g00ecf