Skip to content

fix(release): swap fastembed to rustls + install target on pinned too… #22

fix(release): swap fastembed to rustls + install target on pinned too…

fix(release): swap fastembed to rustls + install target on pinned too… #22

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
build:
name: Build (${{ matrix.triple }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- triple: linux-x64
target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
use_cross: true
- triple: linux-arm64
target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
use_cross: true
- triple: linux-x64-musl
target: x86_64-unknown-linux-musl
os: ubuntu-22.04
use_cross: true
- triple: darwin-x64
target: x86_64-apple-darwin
os: macos-14
use_cross: false
- triple: darwin-arm64
target: aarch64-apple-darwin
os: macos-14
use_cross: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# rust-toolchain.toml pins a specific channel (currently 1.91), so cargo
# ignores whatever `targets` dtolnay installed onto `stable` and uses the
# pinned toolchain instead. Add the target to that pinned toolchain so
# cross-arch macOS builds (darwin-x64 on arm64 runners) actually have
# std available. Not needed for `use_cross: true` entries — cross runs
# inside Docker images that ship their own target.
- name: Install target for pinned toolchain
if: ${{ !matrix.use_cross }}
run: rustup target add ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build binaries
shell: bash
run: |
builder=$([ "${{ matrix.use_cross }}" = "true" ] && echo cross || echo cargo)
$builder build --release --locked --target ${{ matrix.target }} \
-p hoangsa-cli -p hoangsa-memory -p hoangsa-memory-mcp
- name: Stage binaries
shell: bash
run: |
set -euo pipefail
mkdir -p stage/bin
cp target/${{ matrix.target }}/release/hoangsa-cli stage/bin/
cp target/${{ matrix.target }}/release/hoangsa-memory stage/bin/
cp target/${{ matrix.target }}/release/hoangsa-memory-mcp stage/bin/
chmod +x stage/bin/*
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: hoangsa-${{ matrix.triple }}
path: stage/bin/
retention-days: 1
assemble-release:
name: Assemble release tarballs
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Assemble per-triple tarballs
shell: bash
run: |
set -euo pipefail
mkdir -p dist
# Bundle scripts/lib/ui.sh into dist/install.sh so the curl|sh
# endpoint stays a single self-contained file. The awk pass
# strips the runtime source line from the script body.
cat scripts/lib/ui.sh > dist/install.sh
awk '!/^\. "\$\(dirname "\$0"\)\/lib\/ui\.sh"$/' \
scripts/install.sh >> dist/install.sh
chmod 0755 dist/install.sh
sh -n dist/install.sh
for triple in darwin-arm64 darwin-x64 linux-x64 linux-arm64 linux-x64-musl; do
stage="stage/$triple"
mkdir -p "$stage/bin"
cp "artifacts/hoangsa-$triple/hoangsa-cli" "$stage/bin/hoangsa-cli"
cp "artifacts/hoangsa-$triple/hoangsa-memory" "$stage/bin/hoangsa-memory"
cp "artifacts/hoangsa-$triple/hoangsa-memory-mcp" "$stage/bin/hoangsa-memory-mcp"
chmod +x "$stage"/bin/*
cp -r templates "$stage/templates"
[ -f LICENSE ] && cp LICENSE "$stage/LICENSE"
[ -f VERSION ] && cp VERSION "$stage/VERSION"
tar --transform "s,^\./,hoangsa-$triple/," -C "$stage" -czf "dist/hoangsa-$triple.tar.gz" .
done
- name: Compute SHA256SUMS
shell: bash
working-directory: dist
run: |
set -euo pipefail
sha256sum hoangsa-*.tar.gz install.sh > SHA256SUMS
cat SHA256SUMS
- name: Upload to GitHub Release
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1 \
|| gh release create "${GITHUB_REF_NAME}" --generate-notes --verify-tag
gh release upload "${GITHUB_REF_NAME}" \
dist/hoangsa-*.tar.gz \
dist/install.sh \
dist/SHA256SUMS \
--clobber