name: Release Binaries
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: knot-server-x86_64-linux.tar.gz
- os: macos-14
target: aarch64-apple-darwin
artifact: knot-server-aarch64-macos.tar.gz
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Strip binary (Linux)
if: matrix.os == 'ubuntu-latest'
run: strip target/${{ matrix.target }}/release/knot-server
- name: Package artifact
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/knot-server dist/
cp README.md LICENSE dist/ 2>/dev/null || true
tar -czf ${{ matrix.artifact }} -C dist .
- name: Upload artifact to release
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.artifact }}