From 508d06670064df2df19bdae4926cf3c9c241980c Mon Sep 17 00:00:00 2001 From: Micah R Ledbetter Date: Fri, 21 Feb 2025 05:35:13 -0600 Subject: [PATCH] Build a macOS bundle for Intel and ARM (#266) * Build a macOS bundle for Intel and ARM * Build icon.icns file in a script * Add imagemagick * Add macOS bundling to pre/tagged-release actions --- .github/workflows/pre-release.yml | 34 +++++++++++++++++----- .github/workflows/rust.yml | 32 +++++++++++++++++---- .github/workflows/tagged-release.yml | 34 +++++++++++++++++----- Cargo.toml | 5 ++++ scripts/makeicns.sh | 42 ++++++++++++++++++++++++++++ 5 files changed, 127 insertions(+), 20 deletions(-) create mode 100755 scripts/makeicns.sh diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 2392ef2..fccf41c 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -84,36 +84,56 @@ jobs: steps: - uses: actions/checkout@v4 - name: install dependencies - run: brew install gtk4 libadwaita + run: brew install gtk4 libadwaita imagemagick - name: Release Build run: | cargo build --release cp target/release/lan-mouse lan-mouse-macos-intel + - name: Make icns + run: scripts/makeicns.sh + - name: Install cargo bundle + run: cargo install cargo-bundle + - name: Bundle + run: cargo bundle --release + - name: Zip bundle + run: | + cd target/debug/bundle/osx + zip -r "Lan Mouse macOS (Intel).zip" "Lan Mouse.app" - name: Upload build artifact uses: actions/upload-artifact@v4 with: name: lan-mouse-macos-intel - path: lan-mouse-macos-intel + path: target/release/bundle/osx/Lan Mouse macOS (Intel).zip macos-aarch64-release-build: runs-on: macos-14 steps: - uses: actions/checkout@v4 - name: install dependencies - run: brew install gtk4 libadwaita + run: brew install gtk4 libadwaita imagemagick - name: Release Build run: | cargo build --release cp target/release/lan-mouse lan-mouse-macos-aarch64 + - name: Make icns + run: scripts/makeicns.sh + - name: Install cargo bundle + run: cargo install cargo-bundle + - name: Bundle + run: cargo bundle --release + - name: Zip bundle + run: | + cd target/debug/bundle/osx + zip -r "Lan Mouse macOS (ARM).zip" "Lan Mouse.app" - name: Upload build artifact uses: actions/upload-artifact@v4 with: name: lan-mouse-macos-aarch64 - path: lan-mouse-macos-aarch64 + path: target/release/bundle/osx/Lan Mouse macOS (ARM).zip pre-release: name: "Pre Release" - needs: [windows-release-build, linux-release-build, macos-release-build] + needs: [windows-release-build, linux-release-build, macos-release-build, macos-aarch64-release-build] runs-on: "ubuntu-latest" steps: - name: Download build artifacts @@ -127,6 +147,6 @@ jobs: title: "Development Build" files: | lan-mouse-linux/lan-mouse - lan-mouse-macos-intel/lan-mouse-macos-intel - lan-mouse-macos-aarch64/lan-mouse-macos-aarch64 + lan-mouse-macos-intel/Lan Mouse macOS (Intel).zip + lan-mouse-macos-aarch64/Lan Mouse macOS (ARM).zip lan-mouse-windows/lan-mouse-windows.zip diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 836e06e..f5569e5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -98,7 +98,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: install dependencies - run: brew install gtk4 libadwaita + run: brew install gtk4 libadwaita imagemagick - name: Build run: cargo build --verbose - name: Run tests @@ -107,18 +107,28 @@ jobs: run: cargo fmt --check - name: Clippy run: cargo clippy --all-features --all-targets -- --deny warnings + - name: Make icns + run: scripts/makeicns.sh + - name: Install cargo bundle + run: cargo install cargo-bundle + - name: Bundle + run: cargo bundle + - name: Zip bundle + run: | + cd target/debug/bundle/osx + zip -r "Lan Mouse macOS (Intel).zip" "Lan Mouse.app" - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: lan-mouse-macos - path: target/debug/lan-mouse + name: Lan Mouse macOS (Intel) + path: target/debug/bundle/osx/Lan Mouse macOS (Intel).zip build-macos-aarch64: runs-on: macos-14 steps: - uses: actions/checkout@v4 - name: install dependencies - run: brew install gtk4 libadwaita + run: brew install gtk4 libadwaita imagemagick - name: Build run: cargo build --verbose - name: Run tests @@ -127,8 +137,18 @@ jobs: run: cargo fmt --check - name: Clippy run: cargo clippy --all-features --all-targets -- --deny warnings + - name: Make icns + run: scripts/makeicns.sh + - name: Install cargo bundle + run: cargo install cargo-bundle + - name: Bundle + run: cargo bundle + - name: Zip bundle + run: | + cd target/debug/bundle/osx + zip -r "Lan Mouse macOS (ARM).zip" "Lan Mouse.app" - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: lan-mouse-macos-aarch64 - path: target/debug/lan-mouse + name: Lan Mouse macOS (ARM) + path: target/debug/bundle/osx/Lan Mouse macOS (ARM).zip diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml index 0e45163..79a17aa 100644 --- a/.github/workflows/tagged-release.yml +++ b/.github/workflows/tagged-release.yml @@ -80,36 +80,56 @@ jobs: steps: - uses: actions/checkout@v4 - name: install dependencies - run: brew install gtk4 libadwaita + run: brew install gtk4 libadwaita imagemagick - name: Release Build run: | cargo build --release cp target/release/lan-mouse lan-mouse-macos-intel + - name: Make icns + run: scripts/makeicns.sh + - name: Install cargo bundle + run: cargo install cargo-bundle + - name: Bundle + run: cargo bundle --release + - name: Zip bundle + run: | + cd target/debug/bundle/osx + zip -r "Lan Mouse macOS (Intel).zip" "Lan Mouse.app" - name: Upload build artifact uses: actions/upload-artifact@v4 with: name: lan-mouse-macos-intel - path: lan-mouse-macos-intel + path: target/release/bundle/osx/Lan Mouse macOS (Intel).zip macos-aarch64-release-build: runs-on: macos-14 steps: - uses: actions/checkout@v4 - name: install dependencies - run: brew install gtk4 libadwaita + run: brew install gtk4 libadwaita imagemagick - name: Release Build run: | cargo build --release cp target/release/lan-mouse lan-mouse-macos-aarch64 + - name: Make icns + run: scripts/makeicns.sh + - name: Install cargo bundle + run: cargo install cargo-bundle + - name: Bundle + run: cargo bundle --release + - name: Zip bundle + run: | + cd target/debug/bundle/osx + zip -r "Lan Mouse macOS (ARM).zip" "Lan Mouse.app" - name: Upload build artifact uses: actions/upload-artifact@v4 with: name: lan-mouse-macos-aarch64 - path: lan-mouse-macos-aarch64 + path: target/release/bundle/osx/Lan Mouse macOS (ARM).zip tagged-release: name: "Tagged Release" - needs: [windows-release-build, linux-release-build, macos-release-build] + needs: [windows-release-build, linux-release-build, macos-release-build, macos-aarch64-release-build] runs-on: "ubuntu-latest" steps: - name: Download build artifacts @@ -121,6 +141,6 @@ jobs: prerelease: false files: | lan-mouse-linux/lan-mouse - lan-mouse-macos-intel/lan-mouse-macos-intel - lan-mouse-macos-aarch64/lan-mouse-macos-aarch64 + lan-mouse-macos-intel/Lan Mouse macOS (Intel).zip + lan-mouse-macos-aarch64/Lan Mouse macOS (ARM).zip lan-mouse-windows/lan-mouse-windows.zip diff --git a/Cargo.toml b/Cargo.toml index 72dccff..9763eb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,3 +89,8 @@ libei_emulation = ["input-event/libei", "input-emulation/libei"] wlroots_emulation = ["input-emulation/wlroots"] x11_emulation = ["input-emulation/x11"] rdp_emulation = ["input-emulation/remote_desktop_portal"] + +[package.metadata.bundle] +name = "Lan Mouse" +icon = ["target/icon.icns"] +identifier = "de.feschber.LanMouse" diff --git a/scripts/makeicns.sh b/scripts/makeicns.sh new file mode 100755 index 0000000..f443468 --- /dev/null +++ b/scripts/makeicns.sh @@ -0,0 +1,42 @@ +#!/bin/sh +set -e + +usage() { + cat <