name: Release Artifacts
on:
push:
tags:
- "*"
workflow_dispatch:
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
use_cross: false
features: "--features semantic-search"
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
use_cross: false
features: "--features semantic-search"
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
use_cross: true
features: ""
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
use_cross: true
features: ""
- os: macos-14
target: aarch64-apple-darwin
use_cross: false
features: "--features semantic-search"
- os: macos-14
target: x86_64-apple-darwin
use_cross: false
features: "--features semantic-search"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux cross toolchains
if: matrix.os == 'ubuntu-latest' && !matrix.use_cross
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install cross
if: matrix.use_cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build with cross
if: matrix.use_cross
run: cross build --release --target ${{ matrix.target }} ${{ matrix.features }}
- name: Build with cargo
if: ${{ !matrix.use_cross }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: cargo build --release --target ${{ matrix.target }} ${{ matrix.features }}
- name: Set version
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV"
else
echo "VERSION=manual-${GITHUB_RUN_NUMBER}" >> "$GITHUB_ENV"
fi
- name: Package artifact
shell: bash
run: |
set -euo pipefail
mkdir -p dist
name="warmplane-${VERSION}-${{ matrix.target }}"
stage="dist/${name}"
mkdir -p "$stage"
cp "target/${{ matrix.target }}/release/warmplane" "$stage/"
cp README.md "$stage/"
cp docs/openapi.yaml "$stage/"
cp docs/config.schema.json "$stage/"
tar -C dist -czf "dist/${name}.tar.gz" "$name"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: warmplane-${{ matrix.target }}
path: dist/*.tar.gz
if-no-files-found: error
release:
name: Publish GitHub Release Assets
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release-dist
merge-multiple: true
- name: Generate checksums
working-directory: release-dist
run: sha256sum *.tar.gz > checksums.txt
- name: Publish release assets
uses: softprops/action-gh-release@v2
with:
files: |
release-dist/*.tar.gz
release-dist/checksums.txt