Skip to content

Build wordpress images #21

Build wordpress images

Build wordpress images #21

name: 'Build wordpress images'
on:
workflow_dispatch:
permissions:
contents: read
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
prepare-wp:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.wp.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: 'Get all WordPress versions as json array'
id: wp
#language=bash
run: |
result=$(curl -s https://api.wordpress.org/core/version-check/1.7/)
versions=$(echo "$result" | jq -rc '[.offers[].version] | unique | reverse')
latest=$(echo "$result" | jq -rc '[.offers[].version][0]')
echo "matrix=$versions" >> $GITHUB_OUTPUT
echo "latest=$latest" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-22.04
needs:
- prepare-wp
strategy:
fail-fast: false
matrix:
php: ['8.2', '7.4']
wp: ${{ fromJSON(needs.prepare-wp.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/login-ghcr
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/build-push
with:
registry: ghcr.io
cache-mode: 'min'
context: images/wordpress
image: myparcelnl/wordpress
latest: ${{ matrix.wp }} == ${{needs.prepare-wp.outputs.latest}} && ${{ matrix.php }} == '8.2'
suffix: ${{ matrix.wp }}-php${{ matrix.php }}
build-args: |
PHP_VERSION=${{ matrix.php }}
WP_VERSION=${{ matrix.wp }}
notify-on-failure:
needs:
- build
if: always() && contains(needs.*.result, 'failure')
uses: myparcelnl/actions/.github/workflows/notify-on-failure.yml@v4
secrets: inherit