name: Release Binaries
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Release tag to upload binaries to (e.g., v1.0.0)"
required: true
type: string
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
target: x86_64-unknown-linux-musl
- arch: arm64
target: aarch64-unknown-linux-musl
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-targets: true
cache-all-crates: true
- name: Install cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build
run: cross build --release --locked --target ${{ matrix.target }}
- name: Install cargo-deb
uses: taiki-e/install-action@v2
with:
tool: cargo-deb
- name: Prepare artifacts
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/bluebox dist/bluebox-linux-${{ matrix.arch }}
chmod +x dist/bluebox-linux-${{ matrix.arch }}
cargo deb --no-build --target ${{ matrix.target }}
cp target/${{ matrix.target }}/debian/*.deb dist/bluebox_${{ matrix.arch }}.deb
- name: Generate checksums
run: |
cd dist
sha256sum bluebox-linux-${{ matrix.arch }} > bluebox-linux-${{ matrix.arch }}.sha256
sha256sum bluebox_${{ matrix.arch }}.deb > bluebox_${{ matrix.arch }}.deb.sha256
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag || github.ref_name }}
files: |
dist/bluebox-linux-${{ matrix.arch }}
dist/bluebox-linux-${{ matrix.arch }}.sha256
dist/bluebox_${{ matrix.arch }}.deb
dist/bluebox_${{ matrix.arch }}.deb.sha256