name: Test on: push: branches: - main paths: - config.json - Dockerfile - rootfs/** pull_request: branches: - main paths: - config.json - Dockerfile - rootfs/** jobs: init: name: Initialize build runs-on: ubuntu-latest permissions: contents: read outputs: matrix: ${{ steps.matrix.outputs.matrix }} steps: - name: Check out repository uses: actions/checkout@v6.0.3 - name: Build matrix id: matrix run: | # Derive the per-arch build matrix from config.json. amd64 and aarch64 # build on native runners (no QEMU). Base image, build args and labels # all live in the Dockerfile, so nothing extra is needed here. image_template=$(jq -r '.image' config.json) architectures=$(jq -r '.arch[]' config.json) matrix='{"include":[]}' for arch in $architectures; do case "${arch}" in amd64) os="ubuntu-24.04" ;; aarch64) os="ubuntu-24.04-arm" ;; *) echo "::error::Unsupported architecture: ${arch}"; exit 1 ;; esac image="${image_template//\{arch\}/${arch}}" matrix=$(jq -c \ --arg arch "$arch" \ --arg os "$os" \ --arg image "$image" \ '.include += [{arch: $arch, os: $os, image: $image}]' <<< "${matrix}") done echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" build: name: Build ${{ matrix.arch }} add-on needs: init runs-on: ${{ matrix.os }} permissions: contents: read strategy: fail-fast: false matrix: ${{ fromJSON(needs.init.outputs.matrix) }} steps: - name: Check out repository uses: actions/checkout@v6.0.3 - name: Build add-on uses: home-assistant/builder/actions/build-image@2026.03.2 with: arch: ${{ matrix.arch }} image: ${{ matrix.image }} image-tags: test container-registry-password: ${{ secrets.GITHUB_TOKEN }} load: "true" cosign: "false" version: test - name: Image labels run: | docker inspect ${{ matrix.image }}:test --format='{{json .Config.Labels}}' | jq