name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-and-release:
name: Build and Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
name: linux-x86_64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
name: linux-arm64
- os: macos-latest
target: x86_64-apple-darwin
name: macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
name: macos-arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Code Sign (macOS)
if: matrix.os == 'macos-latest'
run: |
# Ad-hoc sign for development distribution (sufficient for Homebrew)
codesign --force --sign - --deep target/${{ matrix.target }}/release/cachebro
- name: Package
run: |
cd target/${{ matrix.target }}/release
tar czf cachebro-${{ matrix.name }}.tar.gz cachebro
mv cachebro-${{ matrix.name }}.tar.gz ../../../
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cachebro-${{ matrix.name }}
path: cachebro-${{ matrix.name }}.tar.gz
release:
name: Create Release
needs: build-and-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/**/*
draft: false
prerelease: false
generate_release_notes: true