diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 773a701..cd1d64a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -116,6 +116,8 @@ jobs: mkdir -p dist ditto -c -k --sequesterRsrc --keepParent "$app" \ "dist/android-cli-gui-v${VERSION}-${{ matrix.artifact }}.zip" + packaging/macos/make-dmg.sh "$app" "$VERSION" \ + "dist/android-cli-gui-v${VERSION}-${{ matrix.artifact }}.dmg" - name: Package (Linux) if: runner.os == 'Linux' shell: bash @@ -191,8 +193,8 @@ jobs: sed \ -e "s/__VERSION__/${VERSION}/g" \ - -e "s/__SHA256_MACOS_ARM64__/$(sha "android-cli-gui-v${VERSION}-macos-arm64.zip")/g" \ - -e "s/__SHA256_MACOS_X86_64__/$(sha "android-cli-gui-v${VERSION}-macos-x86_64.zip")/g" \ + -e "s/__SHA256_MACOS_ARM64__/$(sha "android-cli-gui-v${VERSION}-macos-arm64.dmg")/g" \ + -e "s/__SHA256_MACOS_X86_64__/$(sha "android-cli-gui-v${VERSION}-macos-x86_64.dmg")/g" \ packaging/homebrew/android-cli-gui.cask.rb.tmpl \ > dist/android-cli-gui.rb diff --git a/README.md b/README.md index 6b866a2..5321697 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ If you installed the old formula, remove it before switching: brew uninstall android-cli-gui ``` -Prebuilt applications for macOS (Apple Silicon and Intel), binaries for Linux -and Windows, and checksums are on the +Prebuilt macOS disk images (Apple Silicon and Intel), Windows and Linux +archives, and checksums are on the [releases page](https://github.com/RayhanHamada/android-cli-gui/releases). ## Build from source @@ -58,6 +58,8 @@ cargo build --release version="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml)" packaging/macos/make-app.sh target/release/android-cli-gui "$version" \ "target/Android CLI GUI.app" +packaging/macos/make-dmg.sh "target/Android CLI GUI.app" "$version" \ + "target/android-cli-gui-v${version}-macos-arm64.dmg" open "target/Android CLI GUI.app" ``` diff --git a/packaging/homebrew/android-cli-gui.cask.rb.tmpl b/packaging/homebrew/android-cli-gui.cask.rb.tmpl index 10bc8dc..b78cd54 100644 --- a/packaging/homebrew/android-cli-gui.cask.rb.tmpl +++ b/packaging/homebrew/android-cli-gui.cask.rb.tmpl @@ -5,7 +5,7 @@ cask "android-cli-gui" do sha256 arm: "__SHA256_MACOS_ARM64__", intel: "__SHA256_MACOS_X86_64__" - url "https://github.com/RayhanHamada/android-cli-gui/releases/download/v#{version}/android-cli-gui-v#{version}-#{arch}.zip" + url "https://github.com/RayhanHamada/android-cli-gui/releases/download/v#{version}/android-cli-gui-v#{version}-#{arch}.dmg" name "Android CLI GUI" desc "Unofficial GUI for the official Android CLI" homepage "https://github.com/RayhanHamada/android-cli-gui" diff --git a/packaging/macos/make-dmg.sh b/packaging/macos/make-dmg.sh new file mode 100755 index 0000000..7504837 --- /dev/null +++ b/packaging/macos/make-dmg.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# Build a drag-to-Applications disk image around a signed .app bundle. +# +# Usage: make-dmg.sh +set -euo pipefail + +if [[ $# -ne 3 ]]; then + echo "usage: $0 " >&2 + exit 2 +fi + +app=$1 +version=$2 +output=$3 + +if [[ "$(uname -s)" != "Darwin" ]]; then + echo "make-dmg.sh requires macOS (hdiutil)." >&2 + exit 1 +fi +if [[ ! -d "$app" ]]; then + echo "App bundle not found: $app" >&2 + exit 1 +fi +if [[ "$output" != *.dmg ]]; then + echo "Output must end in .dmg: $output" >&2 + exit 1 +fi + +staging="$(mktemp -d)" +trap 'rm -rf "$staging"' EXIT + +mkdir -p "$staging/root" +ditto "$app" "$staging/root/Android CLI GUI.app" +ln -s /Applications "$staging/root/Applications" + +mkdir -p "$(dirname "$output")" +output_dir="$(cd "$(dirname "$output")" && pwd)" +output="$output_dir/$(basename "$output")" +rm -f "$output" +diskutil image create from \ + --format UDZO \ + --volumeName "Android CLI GUI" \ + "$staging/root" \ + "$output" >/dev/null +hdiutil verify "$output" >/dev/null + +echo "Built $output (Android CLI GUI $version)"