0e084adf8d
build-and-push / build (aarch64, linux/arm64) (push) Has been cancelled
build-and-push / build (amd64, linux/amd64) (push) Has been cancelled
build-and-push / build (armhf, linux/arm/v6) (push) Has been cancelled
build-and-push / build (armv7, linux/arm/v7) (push) Has been cancelled
build-and-push / build (i386, linux/386) (push) Has been cancelled
93 lines
3.2 KiB
YAML
93 lines
3.2 KiB
YAML
# Builds mqtt-cert-manager for every arch in config.yaml and pushes each
|
|
# as its own tag to Gitea's container registry, matching the {arch}
|
|
# template in config.yaml's `image:` field.
|
|
#
|
|
# Setup required before this will work:
|
|
# 1. In Gitea: Settings (your user, top-right avatar) > Applications >
|
|
# Generate New Token, scope "write:package" (and "read:package").
|
|
# The auto-injected Gitea Actions token does NOT reliably work for
|
|
# pushing to the container registry (known upstream issue), so this
|
|
# manual PAT is necessary, not optional.
|
|
# 2. In this repo: Settings > Actions > Secrets > add a secret named
|
|
# REGISTRY_TOKEN with that PAT's value.
|
|
# 3. Edit REGISTRY_HOST and REGISTRY_OWNER below to match your Gitea
|
|
# instance and username/org.
|
|
# 4. Bump `version:` in mqtt-cert-manager/config.yaml before every
|
|
# release — Supervisor pulls the image tag matching that version
|
|
# exactly, so an unbumped version means it silently keeps using the
|
|
# old image.
|
|
|
|
name: build-and-push
|
|
on:
|
|
push:
|
|
paths:
|
|
- "mqtt-cert-manager/**"
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
REGISTRY_HOST: git.example.com
|
|
REGISTRY_OWNER: YOUR_USER
|
|
IMAGE_NAME: mqtt-cert-manager
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- arch: amd64
|
|
platform: linux/amd64
|
|
- arch: aarch64
|
|
platform: linux/arm64
|
|
- arch: armv7
|
|
platform: linux/arm/v7
|
|
- arch: armhf
|
|
platform: linux/arm/v6
|
|
- arch: i386
|
|
platform: linux/386
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Read add-on version
|
|
id: version
|
|
run: |
|
|
VERSION=$(python3 -c "import yaml; print(yaml.safe_load(open('mqtt-cert-manager/config.yaml'))['version'])")
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Read base image for this arch from build.yaml
|
|
id: base
|
|
run: |
|
|
BUILD_FROM=$(python3 -c "
|
|
import yaml
|
|
d = yaml.safe_load(open('mqtt-cert-manager/build.yaml'))
|
|
print(d['build_from']['${{ matrix.arch }}'])
|
|
")
|
|
echo "build_from=$BUILD_FROM" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Set up QEMU (needed to build non-amd64 targets on an amd64 runner)
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY_HOST }}
|
|
username: ${{ env.REGISTRY_OWNER }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./mqtt-cert-manager
|
|
platforms: ${{ matrix.platform }}
|
|
push: true
|
|
build-args: |
|
|
BUILD_FROM=${{ steps.base.outputs.build_from }}
|
|
tags: |
|
|
${{ env.REGISTRY_HOST }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}-${{ matrix.arch }}:${{ steps.version.outputs.version }}
|
|
${{ env.REGISTRY_HOST }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}-${{ matrix.arch }}:latest
|