name: Release
on:
push:
tags:
- "v*"
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: injm
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
binary: injm
- os: macos-26
target: x86_64-apple-darwin
binary: injm
- os: macos-26
target: aarch64-apple-darwin
binary: injm
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: injm.exe
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target/
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Rename binary
shell: bash
run: |
mkdir -p dist
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
cp target/${{ matrix.target }}/release/${{ matrix.binary }} dist/injm-${{ matrix.target }}.exe
else
cp target/${{ matrix.target }}/release/${{ matrix.binary }} dist/injm-${{ matrix.target }}
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: injm-${{ matrix.target }}
path: dist/
release:
name: Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true