Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build and Release Static Multi-Arch Binaries

on:
push:
tags:
- "v*"
workflow_dispatch:

permissions:
contents: write

jobs:
build-and-release:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-unknown-linux-musl
os: ubuntu-24.04-arm
binary_name: hal
output_name: hal-aarch64-unknown-linux-musl
- target: x86_64-unknown-linux-musl
os: ubuntu-24.04
binary_name: hal
output_name: hal-x86_64-unknown-linux-musl

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Install musl-tools (Linux Only)
if: contains(matrix.target, 'linux-musl')
run: |
sudo apt-get update
sudo apt-get install -y musl-tools musl-dev

- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.74.0
targets: ${{ matrix.target }}

- name: Cache Cargo dependencies
uses: swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

- name: Patch broken jobserver dependency
run: cargo update -p jobserver

- name: Build static binary
run: cargo build --release --target ${{ matrix.target }}

- name: Prepare binary for upload
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release/
cp ${{ matrix.binary_name }} ${{ matrix.output_name }}

- name: Create or Update Release and Upload Binary
uses: softprops/action-gh-release@v3
with:
files: |
target/${{ matrix.target }}/release/${{ matrix.output_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}