-
Notifications
You must be signed in to change notification settings - Fork 4
80 lines (72 loc) · 2.28 KB
/
wordpress.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build WordPress
on:
push:
branches:
- master
paths:
- "wordpress/**"
- ".github/workflows/wordpress.yml"
- ".github/actions/build-docker-image/**"
pull_request:
paths:
- "wordpress/**"
- ".github/workflows/wordpress.yml"
- ".github/actions/build-docker-image/**"
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
pull-requests: write
security-events: write
id-token: write
attestations: 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: Build and push image
uses: ./.github/actions/build-docker-image
with:
context: wordpress
push: ${{ github.base_ref == null }}
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 || github.event_name == 'workflow_dispatch' }}
primaryTag: ghcr.io/automattic/vip-container-images/wordpress:${{ matrix.wp.tag }}
tags: ${{ steps.extra-tags.outputs.tags }}