Files
renovate[bot] b21b77c5b0 Update actions/checkout action to v7.0.1 (#149)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-21 06:35:27 +01:00

87 lines
2.8 KiB
YAML

name: "Publish"
on:
release:
types: [published]
workflow_dispatch:
workflow_call:
inputs:
version:
required: false
type: string
jobs:
init:
name: Initialize build
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.version.outputs.version }}
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Checkout the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Get version
id: version
run: |
version="${{ inputs.version }}"
if [ -n "$version" ]; then
echo "version=${version}" >> "$GITHUB_OUTPUT"
else
echo "version=$(curl --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" --silent "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest" | jq -r .tag_name | sed s/v//)" >> "$GITHUB_OUTPUT"
fi
- 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 }} image
needs: init
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.init.outputs.matrix) }}
steps:
- name: Checkout the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build and publish
uses: home-assistant/builder/actions/build-image@4de35182ce1e329181bffcbcc84d33db5e2c7e10 # 2026.06.0
with:
arch: ${{ matrix.arch }}
image: ${{ matrix.image }}
image-tags: |
${{ needs.init.outputs.version }}
latest
container-registry-password: ${{ secrets.GITHUB_TOKEN }}
push: "true"
cosign: "false"
version: ${{ needs.init.outputs.version }}