Make matrix build work #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release llmcat | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
targets: linux | |
setup: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross | |
echo "CC_ARM64=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CXX_ARM64=aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
- os: macos-latest | |
targets: darwin | |
setup: "" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Setup cross-compilation | |
run: ${{ matrix.setup }} | |
- name: Build binaries | |
run: | | |
OS=${{ matrix.targets }} | |
# Build amd64 | |
make bin/$OS/amd64/llmcat | |
# Build arm64 (with cross-compiler for Linux) | |
if [ "$OS" = "linux" ]; then | |
CC=$CC_ARM64 CXX=$CXX_ARM64 make bin/$OS/arm64/llmcat | |
else | |
make bin/$OS/arm64/llmcat | |
fi | |
# Rename for release | |
cd bin | |
for arch in amd64 arm64; do | |
mv $OS/$arch/llmcat llmcat-$OS-$arch | |
done | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-${{ matrix.targets }} | |
path: bin/llmcat-* | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
files: | | |
binaries-*/llmcat-* |