Files
zeekayandHanzo Dev 1bc41b0fc2 Workflows ask for the runner label that exists
One label per runner, spelled <os>-<arch>; the aliases were removed.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 01:52:25 -07:00

103 lines
3.8 KiB
YAML

# A v* tag builds the CLI (macOS arm64, Linux arm64 and x86_64) and the guest
# image per architecture (kernel, initramfs, rootfs with vm-guest) and attaches
# them to the GitHub release the CLI downloads from (crates/vm-cli/src/assets.rs).
# Asset names:
# hanzo-vm-<tag>-darwin-aarch64.tar.gz hanzo-vm binary
# hanzo-vm-<tag>-linux-<arch>.tar.gz hanzo-vm binary (aarch64, x86_64)
# hanzo-vm-os-<tag>-<arch>.tar.gz Image, initramfs.cpio.gz, rootfs.ext4
# Uploads use gh with the runner's GITHUB_TOKEN, as hanzoai/engine does.
name: release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: "Tag to build and upload (e.g. v0.1.0)"
required: true
type: string
permissions:
contents: write
env:
TAG: ${{ inputs.tag || github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: hanzoai/vm
jobs:
cli-darwin:
runs-on: darwin-arm64
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --release -p hanzo-vm
- run: codesign --entitlements vm.entitlements --force -s - target/release/hanzo-vm
- run: tar czf "hanzo-vm-${TAG}-darwin-aarch64.tar.gz" -C target/release hanzo-vm
- run: |
gh release create "$TAG" --title "$TAG" --notes "Release $TAG" 2>/dev/null || true
gh release upload "$TAG" "hanzo-vm-${TAG}-darwin-aarch64.tar.gz" --clobber
cli-linux:
strategy:
matrix:
include:
- runner: linux-arm64
arch: aarch64
- runner: linux-amd64
arch: x86_64
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --release -p hanzo-vm
- run: tar czf "hanzo-vm-${TAG}-linux-${{ matrix.arch }}.tar.gz" -C target/release hanzo-vm
- run: |
gh release create "$TAG" --title "$TAG" --notes "Release $TAG" 2>/dev/null || true
gh release upload "$TAG" "hanzo-vm-${TAG}-linux-${{ matrix.arch }}.tar.gz" --clobber
os:
strategy:
matrix:
include:
- runner: linux-arm64
arch: aarch64
target: aarch64-unknown-linux-musl
- runner: linux-amd64
arch: x86_64
target: x86_64-unknown-linux-musl
runs-on: ${{ matrix.runner }}
timeout-minutes: 180
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- run: |
sudo apt-get update -qq
sudo apt-get install -y -qq musl-tools debootstrap e2fsprogs busybox-static pax-utils cpio \
build-essential bc flex bison libelf-dev libssl-dev curl xz-utils
- run: cargo build -p vm-guest --target ${{ matrix.target }} --release
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc
# prepare-rootfs.sh and build-kernel.sh pick the arch from uname -m,
# which matches the runner.
- run: ./scripts/prepare-rootfs.sh
env:
HANZO_VM_HOME: ${{ github.workspace }}/os
# --sparse: rootfs.ext4 is a mostly-empty 4GB image; the GNU sparse
# entries let the tar crate in assets.rs restore the holes on extract.
- run: tar --format=gnu --sparse -czf "hanzo-vm-os-${TAG}-${{ matrix.arch }}.tar.gz" -C os Image initramfs.cpio.gz rootfs.ext4
- run: |
gh release create "$TAG" --title "$TAG" --notes "Release $TAG" 2>/dev/null || true
gh release upload "$TAG" "hanzo-vm-os-${TAG}-${{ matrix.arch }}.tar.gz" --clobber