name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
archive: tar.gz
use_cross: true
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
archive: tar.gz
use_cross: true
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
use_cross: false
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
use_cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
use_cross: false
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build with cross
if: matrix.use_cross
run: cross build --release --target ${{ matrix.target }}
- name: Build with cargo
if: ${{ !matrix.use_cross }}
run: cargo build --release --target ${{ matrix.target }}
- name: Package (Unix)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar czvf ../../../claude-box-${{ matrix.target }}.tar.gz claude-box
cd ../../..
- name: Package (Windows)
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../claude-box-${{ matrix.target }}.zip claude-box.exe
cd ../../..
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: claude-box-${{ matrix.target }}
path: claude-box-${{ matrix.target }}.${{ matrix.archive }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*
generate_release_notes: true