@@ -25,6 +25,7 @@ concurrency:
2525name : build
2626
2727env :
28+ PHP_VERSION : " 8.4"
2829 REGISTRY : ghcr.io
2930
3031jobs :
@@ -43,34 +44,14 @@ jobs:
4344 - name : Setup Docker Buildx.
4445 uses : docker/setup-buildx-action@v3
4546
46- - name : Prepare tags .
47+ - name : Prepare Tags .
4748 id : tags
48- env :
49- BUILD_TYPE : ${{ matrix.build_type }}
50- PHP_VERSION : " 8.4"
51- run : |
52- BASE_NAME="${REGISTRY}/${{ github.repository_owner }}/apache"
53- FLAVOR="debian-${BUILD_TYPE}"
54-
55- echo "BASE_NAME=${BASE_NAME}" >> "$GITHUB_OUTPUT"
56- echo "PHP_VERSION=${PHP_VERSION}" >> "$GITHUB_OUTPUT"
57-
58- if [[ "${{ github.event_name }}" == "pull_request" ]]; then
59- # For PRs: use PR number
60- PR_NUMBER=${{ github.event.number }}
61- TAG="${BASE_NAME}:${PHP_VERSION}-${FLAVOR}-pr-${PR_NUMBER}"
62- elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
63- # For main: stable tags + short SHA
64- SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
65- TAG="${BASE_NAME}:${PHP_VERSION}-${FLAVOR}"
66- TAG="${TAG},${BASE_NAME}:${PHP_VERSION}-${FLAVOR}-sha-${SHORT_SHA}"
67- else
68- # Other branches: use branch name
69- BRANCH_NAME="${GITHUB_REF#refs/heads/}"
70- TAG="${BASE_NAME}:${PHP_VERSION}-${FLAVOR}-${BRANCH_NAME}"
71- fi
72-
73- echo "TAG=${TAG}" >> "$GITHUB_OUTPUT"
49+ uses : ./.github/actions/prepare-docker-tags
50+ with :
51+ base-name : " ${{ env.REGISTRY }}/${{ github.repository_owner }}/apache"
52+ build-type : ${{ matrix.build_type }}
53+ flavor-prefix : " debian"
54+ php-version : " ${{ env.PHP_VERSION }}"
7455
7556 - name : Build Only.
7657 uses : docker/build-push-action@v6
@@ -80,10 +61,10 @@ jobs:
8061 context : .
8162 file : ./src/flavor/apache/Dockerfile
8263 push : false
83- tags : ${{ steps.tags.outputs.TAG }}
64+ tags : ${{ steps.tags.outputs.tags }}
8465 build-args : |
8566 BUILD_TYPE=${{ matrix.build_type }}
86- PHP_VERSION=${{ steps.tags.outputs .PHP_VERSION }}
67+ PHP_VERSION=${{ env .PHP_VERSION }}
8768 cache-from : >-
8869 type=gha,scope=${{ env.SCOPE }}-${{ matrix.build_type }}
8970 cache-to : >-
9879 run : |
9980 echo "🎉 Build completed for ${BUILD_TYPE}!"
10081 echo "Event: ${EVENT_NAME}"
101- echo "Tags: ${{ steps.tags.outputs.TAG }}"
82+ echo "Tags: ${{ steps.tags.outputs.tags }}"
10283 if [[ "${EVENT_NAME}" == "push" ]]; then
10384 echo "✅ Image pushed to registry"
10485 else
0 commit comments