Skip to content

Commit

Permalink
Try?
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Sep 2, 2024
1 parent cf623ba commit 1c9a9fe
Showing 1 changed file with 50 additions and 50 deletions.
100 changes: 50 additions & 50 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ jobs:
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: macOS-latest
target: x86_64-apple-darwin
- os: macOS-latest
target: aarch64-apple-darwin
- os: windows-latest

runs-on: ${{ matrix.os }}
Expand All @@ -61,50 +57,73 @@ jobs:
if: runner.os == 'Linux'
run: cross build --release --target ${{ matrix.target }}

- name: Build Release (macOS)
if: runner.os == 'macOS'
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }}
- name: Build Release (Windows)
if: runner.os == 'Windows'
run: cargo build --release

- name: Cache cargo-bundle
if: runner.os == 'macOS'
id: cache-cargo-bundle
uses: actions/cache@v4
- name: Make Linux Binary Executable
if: runner.os == 'Linux'
run: chmod +x target/${{ matrix.target }}/release/psst-gui

- name: Upload Linux Binary
uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
path: ~/.cargo/bin/cargo-bundle
key: ${{ runner.os }}-cargo-bundle-${{ hashFiles('**/Cargo.lock') }}
name: psst-gui-${{ matrix.target }}
path: target/${{ matrix.target }}/release/psst-gui

- name: Install cargo-bundle
if: runner.os == 'macOS' && steps.cache-cargo-bundle.outputs.cache-hit != 'true'
run: cargo install cargo-bundle
- name: Upload Windows Executable
uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: Psst.exe
path: target/release/psst-gui.exe

build-macos:
runs-on: macos-latest
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Bundle macOS Release
if: runner.os == 'macOS'
run: cargo bundle --release --target ${{ matrix.target }}
- name: Add ARM64 target
run: rustup target add aarch64-apple-darwin

- name: Create macOS universal binary
if: runner.os == 'macOS' && matrix.target == 'x86_64-apple-darwin'
- name: Build for x86_64
run: cargo build --release --target x86_64-apple-darwin

- name: Build for ARM64
run: cargo build --release --target aarch64-apple-darwin

- name: Create Universal Binary
run: |
lipo -create -output target/release/universal/psst-gui \
mkdir -p target/universal-apple-darwin/release
lipo -create -output target/universal-apple-darwin/release/psst-gui \
target/x86_64-apple-darwin/release/psst-gui \
target/aarch64-apple-darwin/release/psst-gui
- name: Install create-dmg
if: runner.os == 'macOS' && matrix.target == 'x86_64-apple-darwin'
run: brew install create-dmg

- name: Create DMG
if: runner.os == 'macOS' && matrix.target == 'x86_64-apple-darwin'
- name: Create App Bundle
run: |
mkdir -p Psst.app/Contents/MacOS
cp target/release/universal/psst-gui Psst.app/Contents/MacOS/
cp -r target/release/bundle/osx/Psst.app/Contents/Resources Psst.app/Contents/
cp target/release/bundle/osx/Psst.app/Contents/Info.plist Psst.app/Contents/
cp target/universal-apple-darwin/release/psst-gui Psst.app/Contents/MacOS/
# Copy other necessary resources, icons, and Info.plist
# Adjust paths as needed for your project structure
cp -r psst-gui/assets Psst.app/Contents/Resources
cp psst-gui/Info.plist Psst.app/Contents/
- name: Create DMG
run: |
create-dmg \
--volname "Psst" \
--volicon "psst-gui/assets/logo.icns" \
Expand All @@ -120,29 +139,10 @@ jobs:
- name: Upload macOS DMG
uses: actions/upload-artifact@v4
if: runner.os == 'macOS' && matrix.target == 'x86_64-apple-darwin'
with:
name: Psst.dmg
path: Psst.dmg

- name: Make Linux Binary Executable
if: runner.os == 'Linux'
run: chmod +x target/${{ matrix.target }}/release/psst-gui

- name: Upload Linux Binary
uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: psst-gui-${{ matrix.target }}
path: target/${{ matrix.target }}/release/psst-gui

- name: Upload Windows Executable
uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: Psst.exe
path: target/release/psst-gui.exe

deb:
runs-on: ubuntu-latest
needs: build
Expand Down

0 comments on commit 1c9a9fe

Please sign in to comment.