Upgraded PHP 8.4.10 -> 8.5.0 RC. #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Docker image | |
| on: | |
| push: | |
| workflow_dispatch: | |
| env: | |
| registry: ghcr.io | |
| jobs: | |
| Build_image: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| strategy: | |
| matrix: | |
| distro: | |
| - Alpine | |
| - Debian | |
| target: | |
| - prod | |
| - dev | |
| exclude: | |
| - distro: Debian | |
| target: dev | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to the container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.registry }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Declare image name | |
| run: image=${GITHUB_REPOSITORY,,} && <<<image=${image%-*} tee -a "$GITHUB_ENV" | |
| - name: Build Docker image (${{ matrix.distro }}) | |
| run: <$distro.Dockerfile docker build --target $target - | |
| --tag ${tag=${{ env.registry }}/${{ env.image }}:$([[ $target = dev ]] && echo $target || echo ${distro,,})} | |
| && <<<tag=$tag tee -a "$GITHUB_ENV" | |
| env: | |
| distro: ${{ matrix.distro }} | |
| target: ${{ matrix.target }} | |
| - name: Validate image | |
| run: ${{ matrix.target == 'prod' && '!' || '' }} | |
| [[ $(docker run --rm --pull=never ${{ env.tag }} php -m | grep -Fxm1 xdebug) ]] | |
| - name: Push Docker image (${{ env.tag }}) | |
| run: docker push ${{ env.tag }} | |
| - name: Push "latest" tag | |
| run: docker tag "$tag" ${latest=${{ env.registry }}/${{ env.image }}} | |
| && docker push "$latest" | |
| if: matrix.target == 'prod' && matrix.distro == 'Alpine' |