Skip to content

Fix LegacyKeyValueFormat deprecation in Dockerfiles #261

Fix LegacyKeyValueFormat deprecation in Dockerfiles

Fix LegacyKeyValueFormat deprecation in Dockerfiles #261

Workflow file for this run

name: PHP Extension
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 12 * * *'
permissions:
contents: read
packages: write
id-token: write
attestations: write
env:
organization: tideways
image: php
jobs:
debian:
name: Debian
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Extract version from Dockerfile
id: extract_version
working-directory: ./${{ env.image }}/
run: |
echo "version=$(awk '
$1 == "ENV" { env=1 }
env {
for (i=1; i <= NF; i++) {
split($i, a, "=");
if (a[1] == "TIDEWAYS_PHP_VERSION") {
print a[2]
exit
}
}
}
env && !/\\$/ { env=0 }
' Dockerfile)" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v6
id: build
with:
context: ./${{ env.image }}/
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ env.organization }}/${{ env.image }}:latest,ghcr.io/${{ env.organization }}/${{ env.image }}:${{ steps.extract_version.outputs.version }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=${{ env.image }}
cache-to: type=gha,scope=${{ env.image }},mode=max
- uses: actions/attest-build-provenance@v2
if: ${{ github.event_name != 'pull_request' }}
id: attest
with:
subject-name: ghcr.io/${{ env.organization }}/${{ env.image }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
alpine:
name: Alpine
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Extract version from Dockerfile
id: extract_version
working-directory: ./${{ env.image }}/
run: |
echo "version=$(awk '
$1 == "ENV" { env=1 }
env {
for (i=1; i <= NF; i++) {
split($i, a, "=");
if (a[1] == "TIDEWAYS_PHP_VERSION") {
print a[2]
exit
}
}
}
env && !/\\$/ { env=0 }
' Dockerfile)" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v6
id: build
with:
context: ./${{ env.image }}/alpine/
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ env.organization }}/${{ env.image }}:alpine,ghcr.io/${{ env.organization }}/${{ env.image }}:${{ steps.extract_version.outputs.version }}-alpine
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=${{ env.image }}-alpine
cache-to: type=gha,scope=${{ env.image }}-alpine,mode=max
- uses: actions/attest-build-provenance@v2
if: ${{ github.event_name != 'pull_request' }}
id: attest
with:
subject-name: ghcr.io/${{ env.organization }}/${{ env.image }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true