Skip to content

release: v0.8.2 — fix flatten step to rename by upload-name #4

release: v0.8.2 — fix flatten step to rename by upload-name

release: v0.8.2 — fix flatten step to rename by upload-name #4

Workflow file for this run

# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2026 Mohamed Hammad
#
# ZAMAK release workflow: builds all release artifacts on tag push.
name: release
on:
push:
tags: ['v*.*.*']
env:
CARGO_TERM_COLOR: always
jobs:
build-artifacts:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-uefi
artifact: BOOTX64.EFI
- target: aarch64-unknown-uefi
artifact: BOOTAA64.EFI
- target: riscv64gc-unknown-none-elf
artifact: BOOTRISCV64.EFI
- target: loongarch64-unknown-none
artifact: BOOTLOONGARCH64.EFI
# BOOTIA32.EFI (i686-unknown-uefi) is intentionally omitted:
# zamak-uefi/src/paging.rs `compile_error!`s for
# `target_arch = "x86"` because the IA-32 paging path was
# never implemented. Add back when 32-bit x86 UEFI is
# supported in the loader.
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
targets: ${{ matrix.target }}
- name: cargo build --release
run: |
cargo build -p zamak-uefi --release --target ${{ matrix.target }} \
-Z build-std=core,alloc,compiler_builtins \
-Z build-std-features=compiler-builtins-mem
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: target/${{ matrix.target }}/release/*.efi
# `bios-stage3` (zamak-bios.sys BIOS stage-3 binary) is intentionally
# not built here. `cargo build -p zamak-bios --release` for the host
# target fails with a duplicate `_start` symbol (zamak-bios has its
# own freestanding entry). It needs the `i686-zamak.json` custom
# target + `-Z build-std` — gated behind M1-16 completion because
# the BIOS boot chain isn't yet green end-to-end (`call_bios_int`
# trampoline hang). Re-add once M1-16 is `[✓]`.
cli-binaries:
strategy:
matrix:
include:
- runner: ubuntu-latest
name: zamak-linux-x86_64
- runner: macos-latest
name: zamak-macos-aarch64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: build zamak CLI
run: cargo build -p zamak-cli --release
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: target/release/zamak
# Optional FreeBSD CLI build. Runs through `vmactions/freebsd-vm`,
# matches the FreeBSD leg of the CI test matrix so the host CLI
# ships for Linux / macOS / FreeBSD per PRD §6.4 portability.
cli-freebsd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build zamak CLI on FreeBSD 14.x
uses: vmactions/freebsd-vm@v1
with:
release: "14.2"
usesh: true
prepare: |
pkg install -y curl bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --default-toolchain stable --profile minimal
run: |
. $HOME/.cargo/env
cargo build -p zamak-cli --release
mkdir -p /tmp/zamak-freebsd
cp target/release/zamak /tmp/zamak-freebsd/
- uses: actions/upload-artifact@v4
with:
name: zamak-freebsd-x86_64
path: /tmp/zamak-freebsd/zamak
publish:
runs-on: ubuntu-latest
needs: [build-artifacts, cli-binaries, cli-freebsd]
# `gh release create` needs write access to the repo's contents.
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
- uses: dtolnay/rust-toolchain@stable
- name: flatten + rename artifact directories
# Each artifact was uploaded under its own subdir
# (dist/<upload-name>/<inner-file>). The inner file has the
# generic target name (e.g. `zamak-uefi.efi`, `zamak`), so
# multiple entries from the same matrix collapse to the same
# name if we just flatten. Rename each to its upload-name so
# BOOTX64.EFI, BOOTAA64.EFI, zamak-linux-x86_64, … appear as
# distinct GH release assets.
run: |
set -euo pipefail
mkdir -p flat
for dir in dist/*/; do
upload_name=$(basename "$dir")
inner_file=$(find "$dir" -maxdepth 1 -type f | head -1)
if [ -n "$inner_file" ]; then
cp "$inner_file" "flat/${upload_name}"
fi
done
rm -rf dist
mv flat dist
ls -la dist
- name: compute SHA256SUMS
run: |
cd dist
find . -maxdepth 1 -type f -print0 | xargs -0 sha256sum > ../SHA256SUMS
- name: generate SPDX SBOM
run: |
cargo run -p zamak-cli -- sbom \
--release-version "${GITHUB_REF_NAME#v}" \
--output "zamak-${GITHUB_REF_NAME#v}.spdx.json"
- name: create GitHub release + upload assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
# `--generate-notes` uses GH's auto-extracted commit notes;
# CHANGELOG.md carries the curated breakdown.
gh release create "${GITHUB_REF_NAME}" \
--title "Release ${GITHUB_REF_NAME}" \
--generate-notes \
dist/* SHA256SUMS "zamak-${VERSION}.spdx.json"