fix(ci): correct GHCR image names and branch triggers

- Use separate image repos (ghcr.io/host-uk/core-dev, server-php)
- Trigger on dev branch instead of main
- Only build LinuxKit on tags
- Add fail-fast: false to continue if one image fails

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-02-01 16:34:16 +00:00
parent bd10a3f377
commit d8f26497c2

View file

@ -1,22 +1,21 @@
# Host UK Container Images
# Publishes to both GHCR (org access) and Docker Hub (public)
# Publishes to GHCR with separate image repos
#
# GHCR: ghcr.io/host-uk/core-images:{image}
# Docker Hub: lthn/{image}:{version}
# GHCR: ghcr.io/host-uk/core-dev
# GHCR: ghcr.io/host-uk/server-php
name: Build Images
on:
push:
branches: [main, dev]
branches: [dev]
tags: ['v*']
pull_request:
branches: [main, dev]
branches: [dev]
workflow_dispatch:
env:
GHCR_REGISTRY: ghcr.io
DOCKERHUB_ORG: lthn
jobs:
# ============================================================
@ -30,15 +29,16 @@ jobs:
packages: write
strategy:
fail-fast: false
matrix:
image:
- developer
- server-php
include:
- image: developer
dockerhub_name: core-dev
ghcr_name: core-dev
- image: server-php
dockerhub_name: server-php
ghcr_name: server-php
steps:
- name: Checkout
@ -58,34 +58,22 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_REGISTRY }}/host-uk/core-images
${{ env.DOCKERHUB_ORG }}/${{ matrix.dockerhub_name }}
${{ env.GHCR_REGISTRY }}/host-uk/${{ matrix.ghcr_name }}
tags: |
# Tag image variant for GHCR (core-images:developer)
type=raw,value=${{ matrix.image }},enable=${{ github.ref == 'refs/heads/main' }}
# Branch name (core-images:dev, lthn/core-dev:dev)
type=ref,event=branch,suffix=-${{ matrix.image }},enable=${{ github.ref != 'refs/heads/main' }}
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
# dev branch -> dev tag
type=ref,event=branch
# PR number
type=ref,event=pr
# Semver tags (v1.0.0 -> 1.0.0, 1.0, 1)
# Semver tags (v1.0.0 -> 1.0.0, 1.0, 1, latest)
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
# Latest on main
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
flavor: |
latest=false
@ -101,13 +89,13 @@ jobs:
cache-to: type=gha,mode=max
# ============================================================
# Build LinuxKit Images
# Build LinuxKit Images (only on tags)
# ============================================================
linuxkit:
name: LinuxKit (${{ matrix.image }}-${{ matrix.arch }})
runs-on: ubuntu-latest
needs: docker
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
if: startsWith(github.ref, 'refs/tags/v')
strategy:
matrix: