name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
bin: irosh
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
bin: irosh
- target: x86_64-pc-windows-msvc
os: windows-latest
bin: irosh.exe
- target: x86_64-apple-darwin
os: macos-latest
bin: irosh
- target: aarch64-apple-darwin
os: macos-latest
bin: irosh
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu musl-tools
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
shell: bash
run: |
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-musl" ]; then
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc
fi
cargo build --release --workspace --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
mkdir -p dist
for b in ${{ matrix.bin }}; do
cp target/${{ matrix.target }}/release/$b dist/
done
cd dist
tar -czf ../irosh-${{ matrix.target }}.tar.gz *
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
with:
files: irosh-${{ matrix.target }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}