Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 52 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,39 @@ jobs:
run: echo "php_versions=$(make _versions)" >> "$GITHUB_ENV"
build:
name: PHP
runs-on: ubuntu-24.04
needs: php-versions
if: >-
${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
php: ${{ fromJSON(needs.php-versions.outputs.matrix) }}
platform: [linux/arm64, linux/amd64]
include:
- platform: linux/arm64
runner: ubuntu-24.04-arm
- platform: linux/amd64
runner: ubuntu-24.04
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build PHP ${{ matrix.php }}
id: build
uses: docker/build-push-action@v6
with:
file: "Dockerfile"
builder: ${{ steps.buildx.outputs.name }}
push: true
context: .
platforms: linux/amd64,linux/arm64
platforms: ${{ matrix.platform }}
build-args: "php=${{ matrix.php }}"
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
labels: |
org.opencontainers.image.title=PHP ${{ matrix.php }}
org.opencontainers.image.description=Docker image for PHP ${{ matrix.php }} FPM
Expand All @@ -63,6 +64,48 @@ jobs:
org.opencontainers.image.revision=${{ github.sha }}
tags: |
ghcr.io/${{ github.repository }}:${{ matrix.php }}
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v6
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-24.04
needs:
- build
steps:
- name: Download digests
uses: actions/download-artifact@v7
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{ matrix.php }}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create "$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "${DOCKER_METADATA_OUTPUT_JSON}") $(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)"
cleanup:
name: Cleanup
runs-on: ubuntu-24.04
Expand Down