Skip to content

build-macos-image

build-macos-image #53

name: build-macos-image
on:
workflow_dispatch:
inputs:
stage:
description: "boot | install | setup | desktop (WIP, blocked on SA) | verify | slim (reclaim stale clusters, repush same tag)"
required: true
default: "boot"
version_tag:
description: "Image tag under ghcr.io/cocoonstack/cocoon-macos/tahoe"
required: true
default: "26"
disk_size:
description: "Disk image size"
required: true
default: "80G"
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 180
env:
STAGE: ${{ github.event.inputs.stage }}
GHCR_TAG: ${{ github.event.inputs.version_tag }}
DISK_SIZE: ${{ github.event.inputs.disk_size }}
QCOW2_NAME: macos-tahoe-26.qcow2
steps:
- uses: actions/checkout@v5
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/share/boost /opt/ghc \
/usr/local/lib/android /opt/hostedtoolcache/CodeQL
df -h /
- name: Install QEMU + tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
qemu-system-x86 qemu-utils dmg2img socat netpbm python3-pip tesseract-ocr python3-pil sshpass
- name: Verify KVM (load-bearing — gates the whole build)
run: |
ls -l /dev/kvm || { echo "::error::/dev/kvm absent on this runner"; exit 1; }
sudo apt-get install -y cpu-checker || true
kvm-ok || true
- name: Log in to ghcr
if: ${{ github.event.inputs.stage != 'boot' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install oras
if: ${{ github.event.inputs.stage != 'boot' }}
run: |
ORAS_VERSION=1.2.0
curl -fsSL "https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz" \
| sudo tar -xz -C /usr/local/bin oras
oras version
- name: Build (stage=${{ github.event.inputs.stage }})
run: bash scripts/build-qemu-macos.sh
- name: Upload artifacts (screenshots / logs)
if: always()
uses: actions/upload-artifact@v4
with:
name: macos-build-${{ github.event.inputs.stage }}
path: work/qemu-build/artifacts/
if-no-files-found: warn