mirror of
https://github.com/lildude/ha-addon-teslamate.git
synced 2026-10-13 13:10:30 -04:00
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
83 lines
2.4 KiB
YAML
83 lines
2.4 KiB
YAML
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Build add-on
|
|
uses: home-assistant/builder/actions/build-image@4de35182ce1e329181bffcbcc84d33db5e2c7e10 # 2026.06.0
|
|
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
|