Skip to content

Commit

Permalink
Add macOS universal binary build
Browse files Browse the repository at this point in the history
  • Loading branch information
saindriches committed Mar 22, 2023
1 parent 0c9e7be commit a293981
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/release.yml
Expand Up @@ -7,7 +7,8 @@ env:
RELEASE_BIN: dovi_meta
RELEASE_DIR: artifacts
WINDOWS_TARGET: x86_64-pc-windows-msvc
MACOS_TARGET: x86_64-apple-darwin
MACOS_X86_TARGET: x86_64-apple-darwin
MACOS_ARM_TARGET: aarch64-apple-darwin
LINUX_TARGET: x86_64-unknown-linux-musl

jobs:
Expand All @@ -17,7 +18,7 @@ jobs:
strategy:
matrix:
build: [Linux, macOS, Windows]
include:
include:
- build: Linux
os: ubuntu-latest
- build: macOS
Expand Down Expand Up @@ -50,7 +51,11 @@ jobs:
- name: Build (macOS)
if: matrix.build == 'macOS'
run: cargo build --release
run: |
rustup target add ${{ env.MACOS_ARM_TARGET }}
cargo build --release
cargo build --release --target ${{ env.MACOS_ARM_TARGET }}
- name: Build (Windows)
if: matrix.build == 'Windows'
Expand Down Expand Up @@ -82,15 +87,24 @@ jobs:
mv ./target/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_BIN }}.exe
7z a ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ env.RELEASE_PKG_VERSION }}-${{ env.WINDOWS_TARGET }}.zip ./${{ env.RELEASE_BIN }}.exe
- name: Create zipfile (macOS)
- name: Create universal macOS binary
if: matrix.build == 'macOS'
run: |
strip ./target/release/${{ env.RELEASE_BIN }}
mv ./target/release/${{ env.RELEASE_BIN }} ./${{ env.RELEASE_BIN }}
zip -9 ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ env.RELEASE_PKG_VERSION }}-${{ env.MACOS_TARGET }}.zip ./${{ env.RELEASE_BIN }}
strip ./target/aarch64-apple-darwin/release/${{ env.RELEASE_BIN }}
lipo -create \
./target/aarch64-apple-darwin/release/${{ env.RELEASE_BIN }} \
./target/release/${{ env.RELEASE_BIN }} \
-output ./${{ env.RELEASE_BIN }}
- name: Create zipfile (macOS)
if: matrix.build == 'macOS'
run: |
zip -9 ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ env.RELEASE_PKG_VERSION }}-universal-macOS.zip ./${{ env.RELEASE_BIN }}
- name: Upload Zip
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.build }}
path: ./${{ env.RELEASE_DIR }}
path: ./${{ env.RELEASE_DIR }}

0 comments on commit a293981

Please sign in to comment.