Files
devcontainer/.gitea/workflows/build.yaml
T
Job79andClaude Opus 5.5 12534d3afd ci: simplify container build workflow
- Drop the changes job; the on.paths filter already does this.
- Build all images in one job with buildah, so dependent images use the
  freshly built local base instead of pulling it.
- Only push outside of pull requests; PR builds use a pr-<n> tag.
- Reference the base image by its full registry path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 11:46:59 +01:00

45 lines
1.4 KiB
YAML

name: Build containers
on:
workflow_dispatch:
push:
branches: ["main"]
paths: ["containers/**", ".gitea/workflows/build.yaml"]
pull_request:
branches: ["main"]
paths: ["containers/**", ".gitea/workflows/build.yaml"]
schedule:
- cron: "0 16 * * FRI"
env:
REGISTRY: git.plabble.org
# Images in build order; later images build FROM the local base image.
IMAGES: base go infra
TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.ref_name }}
PUSH: ${{ github.event_name != 'pull_request' }}
jobs:
build:
runs-on: job-v2
steps:
- uses: actions/checkout@v6
- name: Build
run: |
for image in $IMAGES; do
pull=missing; [[ $image == base ]] && pull=newer
buildah build --pull="$pull" --platform linux/amd64 \
--build-arg TAG="$TAG" \
-t "$REGISTRY/job79/$image:$TAG" "containers/$image"
done
- name: Push
if: env.PUSH == 'true'
env:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
buildah login -u "$REGISTRY_USERNAME" --password-stdin "$REGISTRY" <<<"$REGISTRY_TOKEN"
for image in $IMAGES; do
buildah push --compression-format=zstd --compression-level=12 "$REGISTRY/job79/$image:$TAG"
done