Skip to content

build latest images of PHP 8.4 #108

build latest images of PHP 8.4

build latest images of PHP 8.4 #108

name: Build Versioned Images
on:
push:
branches:
- '[4-9].[0-9]+.[0-9]+'
- '[4-9].[0-9]+.[0-9]+-?[a-zA-Z]**'
jobs:
build_versioned_images:
runs-on: ubuntu-22.04
if: github.repository == 'swoole/docker-swoole'
strategy:
fail-fast: true
matrix:
php: ["8.1", "8.2", "8.3"]
name: The image for PHP ${{ matrix.php }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set output parameters
id: params
run: |
set -ex
branch_name=${GITHUB_REF##*/}
echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT
if egrep -q '^status\:\s*"under development"\s*($|\#)' "$(pwd)/config/${branch_name}.yml" ; then
major_version=${branch_name%.*}
echo "major_version=${major_version}" >> $GITHUB_OUTPUT
if [ ${{ matrix.php }} == '8.2' ] ; then
if [ ${major_version} == '5.1' ] ; then
echo "image_type=latest" >> $GITHUB_OUTPUT
else
echo "image_type=major" >> $GITHUB_OUTPUT
fi
else
echo "image_type=default" >> $GITHUB_OUTPUT
fi
else
echo "released_already=true" >> $GITHUB_OUTPUT
fi
-
name: Build and push Docker image phpswoole/swoole:${{ steps.params.outputs.branch_name }}-php${{ matrix.php }} (${{ steps.params.outputs.image_type }})
if: steps.params.outputs.released_already != 'true' && steps.params.outputs.image_type == 'latest'
uses: docker/build-push-action@v5
with:
context: .
file: dockerfiles/${{ steps.params.outputs.branch_name }}/php${{ matrix.php }}/cli/Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le
push: true
tags: |
phpswoole/swoole:${{ steps.params.outputs.branch_name }}-php${{ matrix.php }}
phpswoole/swoole:${{ steps.params.outputs.major_version }}-php${{ matrix.php }}
phpswoole/swoole:${{ steps.params.outputs.major_version }}
phpswoole/swoole:latest
-
name: Build and push Docker image phpswoole/swoole:${{ steps.params.outputs.branch_name }}-php${{ matrix.php }} (${{ steps.params.outputs.image_type }})
if: steps.params.outputs.released_already != 'true' && steps.params.outputs.image_type == 'major'
uses: docker/build-push-action@v5
with:
context: .
file: dockerfiles/${{ steps.params.outputs.branch_name }}/php${{ matrix.php }}/cli/Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le
push: true
tags: |
phpswoole/swoole:${{ steps.params.outputs.branch_name }}-php${{ matrix.php }}
phpswoole/swoole:${{ steps.params.outputs.major_version }}-php${{ matrix.php }}
phpswoole/swoole:${{ steps.params.outputs.major_version }}
-
name: Build and push Docker image phpswoole/swoole:${{ steps.params.outputs.branch_name }}-php${{ matrix.php }} (${{ steps.params.outputs.image_type }})
if: steps.params.outputs.released_already != 'true' && steps.params.outputs.image_type == 'default'
uses: docker/build-push-action@v5
with:
context: .
file: dockerfiles/${{ steps.params.outputs.branch_name }}/php${{ matrix.php }}/cli/Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le
push: true
tags: |
phpswoole/swoole:${{ steps.params.outputs.branch_name }}-php${{ matrix.php }}
phpswoole/swoole:${{ steps.params.outputs.major_version }}-php${{ matrix.php }}