Update versions.json #594
Workflow file for this run
This file contains 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 WordPress | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "wordpress/**" | |
- ".github/workflows/wordpress.yml" | |
pull_request: | |
paths: | |
- "wordpress/**" | |
- ".github/workflows/wordpress.yml" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
prepare: | |
name: Prepare build matrix | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Read versions.json | |
id: set-matrix | |
run: | | |
jq -c '.' versions.json | |
echo "matrix=$(jq -c '.' versions.json)" >> $GITHUB_OUTPUT | |
working-directory: wordpress | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
build: | |
name: "Build Docker image (ref: ${{ matrix.wp.ref }}, tag: ${{ matrix.wp.tag }})" | |
runs-on: ubuntu-latest | |
needs: prepare | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
wp: ${{ fromJson(needs.prepare.outputs.matrix) }} | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set additional tags | |
id: extra-tags | |
run: | | |
if [ "${{ matrix.wp.locked }}" = "true" ]; then | |
echo "tags=ghcr.io/automattic/vip-container-images/wordpress:${{ matrix.wp.tag }}-locked" >> $GITHUB_OUTPUT | |
else | |
echo "tags=" >> $GITHUB_OUTPUT | |
fi | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Docker Registry | |
uses: docker/login-action@v3 | |
if: ${{ github.base_ref == null }} | |
with: | |
registry: https://ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build WordPress image | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: wordpress | |
push: ${{ github.base_ref == null }} | |
build-args: WP_GIT_REF=${{ matrix.wp.ref }} | |
cache-from: type=gha,scope=wordpress-${{ matrix.wp.ref }} | |
cache-to: type=gha,mode=max,scope=wordpress-${{ matrix.wp.ref }} | |
no-cache: ${{ matrix.wp.cacheable == false }} | |
tags: | | |
ghcr.io/automattic/vip-container-images/wordpress:${{ matrix.wp.tag }} | |
${{ steps.extra-tags.outputs.tags }} |