name: Build For Release
on:
push:
tags:
- v*
jobs:
build:
name: Build ${{ matrix.arch }}-${{ matrix.os_name }}
runs-on: ${{ matrix.runner_os }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
os_name: linux
runner_os: ubuntu-latest
target: x86_64-unknown-linux-musl
suffix: ""
- arch: aarch64
os_name: linux
runner_os: ubuntu-latest
target: aarch64-unknown-linux-musl
suffix: ""
- arch: x86_64
os_name: windows
runner_os: windows-latest
target: x86_64-pc-windows-msvc
suffix: .exe
- arch: aarch64
os_name: windows
runner_os: windows-latest
target: aarch64-pc-windows-msvc
suffix: .exe
- arch: x86_64
os_name: macos
runner_os: macos-latest
target: x86_64-apple-darwin
suffix: ""
- arch: aarch64
os_name: macos
runner_os: macos-latest
target: aarch64-apple-darwin
suffix: ""
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.os_name == 'linux' && matrix.arch == 'aarch64'
run: cargo install cross
- name: Build (cross)
if: matrix.os_name == 'linux' && matrix.arch == 'aarch64'
run: cross build --release --target ${{ matrix.target }}
- name: Build
if: "!(matrix.os_name == 'linux' && matrix.arch == 'aarch64')"
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare binary
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/oxismet${{matrix.suffix}} dist/oxismet-${{ matrix.arch }}-${{matrix.os_name}}${{ matrix.suffix }}
- name: Upload to Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}