claw-code/.github/workflows/release.yml

80 lines
2.0 KiB
YAML

name: Release binaries
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: build-${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x64
os: ubuntu-latest
bin: claw
artifact_name: claw-linux-x64
target: x86_64-unknown-linux-musl
- name: macos-arm64
os: macos-14
bin: claw
artifact_name: claw-macos-arm64
target: aarch64-apple-darwin
defaults:
run:
working-directory: rust
steps:
- uses: actions/checkout@v4
- name: Install musl-tools (Linux only)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust -> target
- name: Build release binary
run: cargo build --release -p rusty-claude-cli --target ${{ matrix.target }}
- name: Package artifact
shell: bash
run: |
mkdir -p dist
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "dist/${{ matrix.artifact_name }}"
chmod +x "dist/${{ matrix.artifact_name }}"
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
strip "dist/${{ matrix.artifact_name }}"
fi
- name: Upload workflow artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: rust/dist/${{ matrix.artifact_name }}
- name: Upload release asset
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: rust/dist/${{ matrix.artifact_name }}
fail_on_unmatched_files: true