name: Release and Publish
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build for ${{ matrix.os }}(${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: ackit-linux_x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: ackit-windows_x86_64.exe
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: ackit-macos_aarch64
steps:
- uses: actions/checkout@v4
- name: Setup Rust (stable)
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Setup Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "release-${{ matrix.target }}"
cache-targets: "true"
cache-on-failure: "true"
- name: Build
shell: bash
run: |
cargo build --release --locked --target ${{ matrix.target }}
- name: Rename Artifact
shell: bash
run: |
cd target/${{ matrix.target }}/release/
if [ "${{ runner.os }}" == "Windows" ]; then
mv ackit.exe ${{ matrix.artifact_name }}
else
mv ackit ${{ matrix.artifact_name }}
fi
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}