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:
parent
bd10a3f377
commit
d8f26497c2
1 changed files with 15 additions and 27 deletions
42
.github/workflows/build.yml
vendored
42
.github/workflows/build.yml
vendored
|
|
@ -1,22 +1,21 @@
|
||||||
# Host UK Container Images
|
# 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}
|
# GHCR: ghcr.io/host-uk/core-dev
|
||||||
# Docker Hub: lthn/{image}:{version}
|
# GHCR: ghcr.io/host-uk/server-php
|
||||||
|
|
||||||
name: Build Images
|
name: Build Images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main, dev]
|
branches: [dev]
|
||||||
tags: ['v*']
|
tags: ['v*']
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main, dev]
|
branches: [dev]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GHCR_REGISTRY: ghcr.io
|
GHCR_REGISTRY: ghcr.io
|
||||||
DOCKERHUB_ORG: lthn
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
@ -30,15 +29,16 @@ jobs:
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
image:
|
image:
|
||||||
- developer
|
- developer
|
||||||
- server-php
|
- server-php
|
||||||
include:
|
include:
|
||||||
- image: developer
|
- image: developer
|
||||||
dockerhub_name: core-dev
|
ghcr_name: core-dev
|
||||||
- image: server-php
|
- image: server-php
|
||||||
dockerhub_name: server-php
|
ghcr_name: server-php
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -58,34 +58,22 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
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
|
- name: Extract metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
${{ env.GHCR_REGISTRY }}/host-uk/core-images
|
${{ env.GHCR_REGISTRY }}/host-uk/${{ matrix.ghcr_name }}
|
||||||
${{ env.DOCKERHUB_ORG }}/${{ matrix.dockerhub_name }}
|
|
||||||
tags: |
|
tags: |
|
||||||
# Tag image variant for GHCR (core-images:developer)
|
# dev branch -> dev tag
|
||||||
type=raw,value=${{ matrix.image }},enable=${{ github.ref == 'refs/heads/main' }}
|
type=ref,event=branch
|
||||||
# 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' }}
|
|
||||||
# PR number
|
# PR number
|
||||||
type=ref,event=pr
|
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={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
|
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
|
||||||
# Latest on main
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
||||||
flavor: |
|
flavor: |
|
||||||
latest=false
|
latest=false
|
||||||
|
|
||||||
|
|
@ -101,13 +89,13 @@ jobs:
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# Build LinuxKit Images
|
# Build LinuxKit Images (only on tags)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
linuxkit:
|
linuxkit:
|
||||||
name: LinuxKit (${{ matrix.image }}-${{ matrix.arch }})
|
name: LinuxKit (${{ matrix.image }}-${{ matrix.arch }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: docker
|
needs: docker
|
||||||
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue