Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix macOS build #518

Merged
merged 5 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,40 +68,46 @@ jobs:
if: runner.os == 'Windows'
run: cargo build --release

- name: Cache cargo-bundle
if: runner.os == 'macOS'
id: cache-cargo-bundle
- name: Cache cargo-bundle and Homebrew
id: cache-tools
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-bundle
key: ${{ runner.os }}-cargo-bundle-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/bin/cargo-bundle
~/Library/Caches/Homebrew
/usr/local/Cellar/create-dmg
key: ${{ runner.os }}-tools-${{ hashFiles('**/Cargo.lock', '.github/workflows/build.yml') }}
restore-keys: |
${{ runner.os }}-tools-

- name: Install cargo-bundle
if: runner.os == 'macOS' && steps.cache-cargo-bundle.outputs.cache-hit != 'true'
if: runner.os == 'macOS' && !steps.cache-tools.outputs.cache-hit
run: cargo install cargo-bundle

- name: Bundle macOS Release
if: runner.os == 'macOS'
run: cargo bundle --release
working-directory: psst-gui
- name: Install create-dmg
if: runner.os == 'macOS' && !steps.cache-tools.outputs.cache-hit
run: brew install create-dmg

- name: Create macOS universal binary
if: runner.os == 'macOS'
run: |
lipo -create -output target/release/bundle/osx/Psst.app/Contents/MacOS/psst-gui \
mkdir -p psst-gui/target/release
lipo -create -output psst-gui/target/release/psst-gui \
target/x86_64-apple-darwin/release/psst-gui \
target/aarch64-apple-darwin/release/psst-gui

- name: Install create-dmg
- name: Bundle macOS Release
if: runner.os == 'macOS'
run: brew install create-dmg
run: cargo bundle --release
working-directory: psst-gui

- name: Create DMG
if: runner.os == 'macOS'
run: |
brew install create-dmg
create-dmg \
--volname "Psst" \
--volicon "psst-gui/assets/logo.icns" \
--volicon "assets/logo.icns" \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 100 \
Expand All @@ -111,13 +117,14 @@ jobs:
--no-internet-enable \
"Psst.dmg" \
"target/release/bundle/osx/Psst.app"
working-directory: psst-gui

- name: Upload macOS DMG
uses: actions/upload-artifact@v4
if: runner.os == 'macOS'
with:
name: Psst.dmg
path: Psst.dmg
path: ./psst-gui/Psst.dmg

- name: Make Linux Binary Executable
if: runner.os == 'Linux'
Expand Down
Loading