Files
nixos-config/.gitea/workflows/iso-builder.yml
T
rogueking dc28dc06b4
Build NixOS ISOs / build-iso (buildbox) (push) Successful in 5m18s
fixing gitea push
2026-06-14 22:52:30 -04:00

101 lines
3.1 KiB
YAML

name: Build NixOS ISOs
on:
push:
paths:
- hosts/acheron/**
- hosts/armaros/**
- hosts/buildbox/**
- hosts/eva-01/**
- hosts/eva-03/**
- hosts/iso/**
- flake.nix
- flake.lock
- .gitea/workflows/iso-builder.yml
workflow_dispatch:
inputs:
upload-artifact:
description: "Upload the ISOs as artifacts"
type: boolean
default: true
jobs:
build-iso:
strategy:
matrix:
host:
#- eva-01
#- armaros
#- ender-ml
- buildbox
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
download-buffer-size = 200000000
auto-optimise-store = true
- name: Build ${{ matrix.host }} ISO (nixos-generators)
run: |
nix run github:nix-community/nixos-generators -- \
-f iso \
--flake .#${{ matrix.host }}-iso \
-o iso-result
- name: Show ${{ matrix.host }} ISO info
run: |
ISO_SRC=$(find -L iso-result -name '*.iso' -type f | head -n 1)
if [ -z "$ISO_SRC" ]; then
echo "No ISO found under iso-result"
ls -la iso-result || true
find -L iso-result -maxdepth 3 -type f || true
exit 1
fi
echo "ISO built successfully:"
ls -lh "$ISO_SRC"
echo ""
echo "SHA256:"
sha256sum "$ISO_SRC"
- name: Prepare ${{ matrix.host }} ISO artifact (split if needed)
run: |
set -euo pipefail
mkdir -p iso-result/artifact
ISO_SRC=$(find -L iso-result -name '*.iso' -type f | head -n 1)
if [ -z "$ISO_SRC" ]; then
echo "No ISO found under iso-result"
ls -la iso-result || true
find -L iso-result -maxdepth 3 -type f || true
exit 1
fi
ISO_BASENAME="${{ matrix.host }}-installer.iso"
ISO_DEST="iso-result/artifact/${ISO_BASENAME}"
cp "$ISO_SRC" "$ISO_DEST"
SIZE=$(stat -c%s "$ISO_DEST")
if [ "$SIZE" -gt 240000000 ]; then
echo "ISO is $SIZE bytes; splitting into 200MB parts for artifact upload."
split -b 200M -d -a 3 "$ISO_DEST" "${ISO_DEST}.part-"
sha256sum "$ISO_DEST" > "${ISO_DEST}.sha256"
rm "$ISO_DEST"
printf "Reassemble:\n cat %s.part-* > %s\nVerify:\n sha256sum -c %s.sha256\n" \
"$ISO_BASENAME" "$ISO_BASENAME" "$ISO_BASENAME" \
> "iso-result/artifact/README.txt"
else
sha256sum "$ISO_DEST" > "${ISO_DEST}.sha256"
fi
- name: Upload ${{ matrix.host }} ISO artifact
if: ${{ github.event_name != 'workflow_dispatch' || inputs.upload-artifact }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.host }}-installer-iso
path: iso-result/artifact/**