135 lines
3.9 KiB
YAML
135 lines
3.9 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build:
|
|
name: Build (${{ matrix.target }})
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- target: x86_64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
use-cross: false
|
|
- target: aarch64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
use-cross: true
|
|
- target: x86_64-apple-darwin
|
|
os: macos-latest
|
|
use-cross: false
|
|
- target: aarch64-apple-darwin
|
|
os: macos-latest
|
|
use-cross: false
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: ${{ matrix.target }}
|
|
- name: Install cross
|
|
if: matrix.use-cross
|
|
run: cargo install cross --locked
|
|
- name: Build
|
|
run: |
|
|
if [ "${{ matrix.use-cross }}" = "true" ]; then
|
|
cross build --release --workspace --target ${{ matrix.target }}
|
|
else
|
|
cargo build --release --workspace --target ${{ matrix.target }}
|
|
fi
|
|
- name: Package
|
|
run: |
|
|
cd target/${{ matrix.target }}/release
|
|
tar czf ../../../symclaw-${{ github.ref_name }}-${{ matrix.target }}.tar.gz symclaw symclaw-skill 2>/dev/null || \
|
|
tar czf ../../../symclaw-${{ github.ref_name }}-${{ matrix.target }}.tar.gz symclaw
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-${{ matrix.target }}
|
|
path: symclaw-*.tar.gz
|
|
|
|
wasm:
|
|
name: WASM Package
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: wasm32-unknown-unknown
|
|
- name: Install wasm-pack
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
- run: wasm-pack build crates/symclaw-wasm --target web
|
|
- name: Package
|
|
run: tar czf symclaw-wasm-${{ github.ref_name }}.tar.gz -C crates/symclaw-wasm/pkg .
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-wasm
|
|
path: symclaw-wasm-*.tar.gz
|
|
|
|
docker:
|
|
name: Docker Image
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: docker/setup-buildx-action@v3
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
|
|
ghcr.io/${{ github.repository }}:latest
|
|
platforms: linux/amd64,linux/arm64
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
publish:
|
|
name: Publish to crates.io
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- name: Publish symclaw-core
|
|
run: cargo publish -p symclaw-core --token ${{ secrets.CRATES_IO_TOKEN }}
|
|
- name: Wait for crates.io index
|
|
run: sleep 30
|
|
- name: Publish remaining crates
|
|
run: |
|
|
for crate in symclaw-cli symclaw-wasm symclaw-skill; do
|
|
cargo publish -p "$crate" --token ${{ secrets.CRATES_IO_TOKEN }} || true
|
|
sleep 10
|
|
done
|
|
|
|
release:
|
|
name: GitHub Release
|
|
runs-on: ubuntu-latest
|
|
needs: [build, wasm]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: release-*
|
|
merge-multiple: true
|
|
path: artifacts/
|
|
- uses: softprops/action-gh-release@v2
|
|
with:
|
|
generate_release_notes: true
|
|
files: artifacts/*
|