fetch_ml/.github/workflows/release.yml
Jeremie Fraeys e5dcb347d8 feat: add GitHub workflows and development tooling
- Add comprehensive CI/CD workflows for testing and releases
- Include issue and pull request templates
- Add GitHub labeler configuration for automated triage
- Include license check and stale issue management
- Add Windsurf rules for development workflow
- Include database directory structure with gitkeep

Provides complete GitHub automation and development tooling
for streamlined contribution and project management.
2025-12-04 16:56:25 -05:00

197 lines
5.7 KiB
YAML

name: Release
on:
push:
tags:
- 'v*' # Trigger on version tags like v1.0.0
permissions:
contents: write
packages: write
env:
GO_VERSION: '1.25.0'
ZIG_VERSION: '0.15.2'
jobs:
prepare_rsync:
name: Prepare rsync metadata
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.manifest.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Load rsync manifest
id: manifest
run: |
MANIFEST=.github/rsync_manifest.json
MATRIX=$(jq -c '
. as $cfg
| $cfg.platforms
| to_entries
| map({
platform: .key,
target: .value.target,
"rsync-url": ($cfg.base_url + "/" + $cfg.version + "/" + .value.asset),
"rsync-sha256": .value.sha256
})
' "$MANIFEST")
printf 'matrix={"include":%s}\n' "$MATRIX" >> "$GITHUB_OUTPUT"
build-cli:
name: Build CLI - ${{ matrix.platform }}
needs: prepare_rsync
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.prepare_rsync.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}
- name: Download static rsync
run: |
mkdir -p cli/src/assets
wget -O cli/src/assets/rsync_release.bin ${{ matrix.rsync-url }} || \
curl -L -o cli/src/assets/rsync_release.bin ${{ matrix.rsync-url }}
echo "${{ matrix.rsync-sha256 }} cli/src/assets/rsync_release.bin" | sha256sum -c
chmod +x cli/src/assets/rsync_release.bin
ls -lh cli/src/assets/rsync_release.bin
- name: Build CLI
working-directory: cli
run: |
zig build -Dtarget=${{ matrix.target }} -Doptimize=ReleaseSmall
ls -lh zig-out/bin/ml
- name: Strip binary (Linux only)
if: matrix.platform == 'linux-x86_64'
working-directory: cli
run: strip zig-out/bin/ml
- name: Package binary
run: |
mkdir -p dist
cp cli/zig-out/bin/ml dist/ml-${{ matrix.platform }}
cd dist
tar -czf ml-${{ matrix.platform }}.tar.gz ml-${{ matrix.platform }}
sha256sum ml-${{ matrix.platform }}.tar.gz > ml-${{ matrix.platform }}.tar.gz.sha256
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ml-${{ matrix.platform }}
path: |
dist/ml-${{ matrix.platform }}.tar.gz
dist/ml-${{ matrix.platform }}.tar.gz.sha256
build-go-backends:
name: Build Go Backends
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build binaries
run: |
make cross-platform
ls -lh dist/
- name: Package binaries
run: |
cd dist
for binary in api-server worker tui data_manager user_manager; do
if [[ -f "${binary}" ]]; then
tar -czf "fetch_ml_${binary}.tar.gz" "${binary}"
sha256sum "fetch_ml_${binary}.tar.gz" > "fetch_ml_${binary}.tar.gz.sha256"
fi
done
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: go-backends
path: |
dist/*.tar.gz
dist/*.sha256
create-release:
name: Create GitHub Release
needs: [build-cli, build-go-backends]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release
# Copy CLI binaries
cp artifacts/ml-*/ml-*.tar.gz* release/
# Copy Go binaries
cp artifacts/go-backends/*.tar.gz* release/
# Generate combined checksums
cd release
sha256sum *.tar.gz > checksums.txt
ls -lh
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: release/*
body: |
## 🚀 Release ${{ github.ref_name }}
### CLI Binaries (Zero Dependencies)
All CLI binaries include embedded static rsync for complete independence.
- **`ml-linux-x86_64.tar.gz`** - Linux x86_64 (fully static, musl)
- **`ml-macos-x86_64.tar.gz`** - macOS Intel
- **`ml-macos-arm64.tar.gz`** - macOS Apple Silicon
### Go Backend Binaries
- **`fetch_ml_api-server.tar.gz`** - API Server
- **`fetch_ml_worker.tar.gz`** - Worker
- **`fetch_ml_tui.tar.gz`** - Terminal UI
- **`fetch_ml_data_manager.tar.gz`** - Data Manager
- **`fetch_ml_user_manager.tar.gz`** - User Manager
### Installation
```bash
# Download and extract
tar -xzf ml-<platform>.tar.gz
# Make executable and move to PATH
chmod +x ml-<platform>
sudo mv ml-<platform> /usr/local/bin/ml
# Verify installation
ml --help
```
### Checksums
SHA256 checksums are provided in `checksums.txt` and individual `.sha256` files.
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}