Skip to content

PHP-CLI-DEV

PHP-CLI-DEV #18

Workflow file for this run

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 }}