on:
release:
types: [created]
jobs:
release:
name: release macOS binaries
runs-on: macos-latest
steps:
- name: Installing Rust toolchain for x86_64
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-apple-darwin
override: true
components: rustfmt, clippy
- name: Installing Rust toolchain for aarch64
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: aarch64-apple-darwin
override: true
components: rustfmt, clippy
- name: Checking out sources
uses: actions/checkout@v1
- name: Running cargo build for x86_64
uses: actions-rs/cargo@v1
with:
command: build
toolchain: stable
args: --locked --release --target x86_64-apple-darwin
- name: Running cargo build for aarch64
uses: actions-rs/cargo@v1
with:
command: build
toolchain: stable
args: --locked --release --target aarch64-apple-darwin
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Packaging final binary for x86_64
shell: bash
run: |
cd target/x86_64-apple-darwin/release
tar czvf genius_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz genius
shasum -a 512 genius_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz > genius_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz.sha512
- name: Packaging final binary for aarch64
shell: bash
run: |
cd target/aarch64-apple-darwin/release
tar czvf genius_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz genius
shasum -a 512 genius_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz > genius_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz.sha512
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: |
target/x86_64-apple-darwin/release/genius_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz
target/x86_64-apple-darwin/release/genius_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz.sha512
target/aarch64-apple-darwin/release/genius_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz
target/aarch64-apple-darwin/release/genius_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz.sha512
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}