Skip to content

Commit

Permalink
Add: macOS arm64 (#142)
Browse files Browse the repository at this point in the history
Signed-off-by: zrll_ <[email protected]>
  • Loading branch information
zrll12 authored Sep 9, 2024
1 parent 950759d commit 7dcb250
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
GITHUB_REF: '${{ github.ref }}'
WINDOWS_TARGET: x86_64-pc-windows-msvc
MACOS_TARGET: x86_64-apple-darwin
MACOS_ARM64_TARGET: aarch64-apple-darwin
LINUX_TARGET: x86_64-unknown-linux-gnu

# Space separated paths to include in the archive.
Expand All @@ -30,6 +31,11 @@ jobs:
rust: stable
- build: macos
os: macos-latest
MACOSX_DEPLOYMENT_TARGET: 10.7
rust: stable
- build: macos_arm64
os: macos-latest
MACOSX_DEPLOYMENT_TARGET: 11.0
rust: stable
- build: windows
os: windows-latest
Expand Down Expand Up @@ -71,6 +77,12 @@ jobs:
- name: Build (MacOS)
if: matrix.build == 'macos'
run: cargo build --release --workspace
- name: Build for macOS ARM64
if: matrix.build == 'macos_arm64'
run: |
rustup target add ${{ env.MACOS_ARM64_TARGET }}
cargo build --release --target=${{ env.MACOS_ARM64_TARGET }} --workspace
- name: Build (Windows)
if: matrix.build == 'windows'
Expand Down Expand Up @@ -108,6 +120,16 @@ jobs:
done
mv ${{ env.RELEASE_ADDS }} ./dist
7z a -tzip ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.zip ./dist
- name: Create tarball (MacOS ARM64)
if: matrix.build == 'macos_arm64'
run: |
for bin in ${{ env.RELEASE_BINS }}
do
mv ./target/release/${bin} ./dist/${bin}
done
mv ${{ env.RELEASE_ADDS }} ./dist
7z a -tzip ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_ARM64_TARGET }}.zip ./dist
- name: Upload Zip
uses: actions/upload-artifact@v1
with:
Expand Down Expand Up @@ -140,7 +162,7 @@ jobs:
with:
name: linux

- name: Download MacOS tarball
- name: Download Windows tarball
uses: actions/download-artifact@v1
with:
name: windows
Expand All @@ -150,6 +172,11 @@ jobs:
with:
name: macos

- name: Download MacOS ARM64 tarball
uses: actions/download-artifact@v1
with:
name: macos_arm64

- name: Release Linux tarball
uses: actions/upload-release-asset@v1
env:
Expand Down Expand Up @@ -178,3 +205,13 @@ jobs:
asset_path: ./macos/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.zip
asset_content_type: application/zip
asset_name: ${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.zip
- name: Release MacOS ARM64 tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./macos_arm64/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_ARM64_TARGET }}.zip
asset_content_type: application/zip
asset_name: ${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_ARM64_TARGET }}.zip

0 comments on commit 7dcb250

Please sign in to comment.