Fix CI runner images to build macos m1
and intel
versions properl…
#436
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
tags: | |
- "v*.*.*" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: | |
- windows-latest | |
- buildjet-16vcpu-ubuntu-2004 | |
- macos-latest | |
- macos-latest-large # intel | |
runs-on: ${{ matrix.os }} | |
env: | |
MATRIX_OS: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Latest Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
override: true | |
- name: Build | |
id: build | |
shell: bash | |
run: | | |
cargo build --all --release | |
binary_extension="" | |
if [[ "$RUNNER_OS" == "Linux" ]]; then | |
binary_path="metaboss-ubuntu-latest" | |
fi | |
if [[ "${RUNNER_OS}" == "Windows" ]]; then | |
binary_extension=".exe" | |
binary_path="metaboss-windows-latest${binary_extension}" | |
fi | |
if [[ "${RUNNER_OS}" == "macOS" ]]; then | |
if [[ "${MATRIX_OS}" == "macos-latest" ]]; then | |
binary_path="metaboss-macos-m1-latest" | |
else | |
binary_path="metaboss-macos-intel-latest" | |
fi | |
fi | |
mv "target/release/metaboss${binary_extension}" "${binary_path}" | |
echo "::set-output name=binary_path::${binary_path}" | |
strip "${binary_path}" | |
- name: Release Tags | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ${{ steps.build.outputs.binary_path }} |