Skip to content

Commit

Permalink
Support macOS universal binaries (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-engel authored Aug 21, 2024
1 parent 1d7cc99 commit 0fbebb3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,23 @@ jobs:
with:
packages: musl-tools # provides musl-gcc
version: 1.0
- name: Install ARM target for macOS
if: ${{ runner.os == 'macOS' }}
run: rustup target add aarch64-apple-darwin
- name: Cargo build
run: cargo build --target=${{ matrix.target }} --release
- name: Cargo build macOS ARM
if: ${{ runner.os == 'macOS' }}
run: cargo build --target=aarch64-apple-darwin --release
- name: Build universal binary for macOS
if: ${{ runner.os == 'macOS' }}
run: lipo -create -output jwt target/${{ matrix.target }}/release/jwt target/aarch64-apple-darwin/release/jwt
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.target }}/release
if [ "$RUNNER_OS" != "macOS" ]; then
cd target/${{ matrix.target }}/release
fi
strip jwt${{ matrix.binary_postfix }}
tar czvf jwt-${{ matrix.artifact_prefix }}.tar.gz jwt${{ matrix.binary_postfix }}
if [[ ${{ runner.os }} == 'Windows' ]]; then
Expand All @@ -62,6 +73,7 @@ jobs:
fi
- name: Releasing assets
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'push' }}
with:
files: |
target/${{ matrix.target }}/release/jwt-${{ matrix.artifact_prefix }}.tar.gz
Expand All @@ -70,6 +82,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-cargo:
if: ${{ github.event_name == 'push' }}
name: Publishing to Cargo
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 0fbebb3

Please sign in to comment.