-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (90 loc) · 3.48 KB
/
build-cli-dev.yml
File metadata and controls
101 lines (90 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: PHP-CLI-DEV
on:
workflow_run:
workflows: [ "PHP-CLI" ]
types: [ completed ]
# Optional: allow manual runs
workflow_dispatch:
permissions:
contents: read
packages: write # push to GHCR
id-token: write # cosign keyless
env:
DOCKERHUB_NS: liquidrazor
GHCR_NS: ghcr.io/liquidrazor
# Patch versions (immutable tag source)
PHP_LATEST: ${{ vars.PHP_LATEST }}
PHP_PREVIOUS: ${{ vars.PHP_PREVIOUS }}
jobs:
build:
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
runs-on: blacksmith-4vcpu-ubuntu-2404
strategy:
fail-fast: false
matrix:
include:
# -------- PHP LATEST --------
- php_version_env: PHP_LATEST
base_target: cli
# keep your intent: latest also gets the rolling "cli-dev" tag
want_latest_rollup: true
# -------- PHP PREVIOUS --------
- php_version_env: PHP_PREVIOUS
base_target: cli
want_latest_rollup: false
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- name: Setup Blacksmith Builder
uses: useblacksmith/setup-docker-builder@v1
# Login to GHCR
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Login to Docker Hub
- uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Derive LINE (major.minor) and PATCH from the env-sourced patch version
- name: Compute version strings
id: vers
shell: bash
run: |
PATCH="${{ env[matrix.php_version_env] }}"
LINE="${PATCH%.*}"
echo "patch=${PATCH}" >> "$GITHUB_OUTPUT"
echo "line=${LINE}" >> "$GITHUB_OUTPUT"
# Extra rolling tag only for LATEST
if [ "${{ matrix.want_latest_rollup }}" = "true" ]; then
{
echo "tags_extra<<__EXTRA__"
echo "${{env.GHCR_NS}}/php:cli-dev"
echo "docker.io/${{env.DOCKERHUB_NS}}/php:cli-dev" # docker.io is optional but explicit
echo "__EXTRA__"
} >> "$GITHUB_OUTPUT"
else
echo "tags_extra=" >> "$GITHUB_OUTPUT"
fi
- name: Build & Push ${{ steps.vers.outputs.line }} ${{ matrix.base_target }}
id: build
uses: useblacksmith/build-push-action@v2
with:
context: docker/php/cli/development
file: docker/php/cli/development/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
build-args: |
PHP_VERSION=${{ steps.vers.outputs.patch }}
BASE_IMAGE=${{ env.GHCR_NS }}/php:${{ steps.vers.outputs.patch }}-${{ matrix.base_target }}
# Separate caches per LINE and target
# ---- TAGS: rolling + immutable (patch-pinned) ----
tags: |
${{ env.GHCR_NS }}/php:${{ steps.vers.outputs.line }}-cli-dev
docker.io/${{ env.DOCKERHUB_NS }}/php:${{ steps.vers.outputs.line }}-cli-dev
${{ steps.vers.outputs.tags_extra }}
${{ env.GHCR_NS }}/php:${{ steps.vers.outputs.patch }}-${{ matrix.base_target }}
docker.io/${{ env.DOCKERHUB_NS }}/php:${{ steps.vers.outputs.patch }}-${{ matrix.base_target }}