forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (62 loc) · 2.35 KB
/
reusable-build-package.yml
File metadata and controls
74 lines (62 loc) · 2.35 KB
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
##
# A reusable workflow that builds and packages WordPress. The resulting package can be used to test upgrading and installing.
##
name: Build and package WordPress
on:
workflow_call:
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
# Builds and packages WordPress.
#
# Performs the following steps:
# - Checks out the repository.
# - Retrieves the pinned commit hash for the Gutenberg repository.
# - Configures caching for the /gutenberg directory.
# - Sets up Node.js.
# - Runs the build script.
# - Prepares the directory structure for the ZIP.
# - Creates a ZIP of the built files.
# - Uploads the ZIP as a GitHub Actions artifact.
build:
name: WordPress
permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Retrieve the pinned Gutenberg SHA value
id: gutenberg-pinned-sha
run: echo "sha=$(jq -r '.gutenberg.ref' package.json)" >> "$GITHUB_OUTPUT"
- name: Configure caching for Gutenberg directory.
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: |
gutenberg
!gutenberg/node_modules/
key: gutenberg-${{ steps.gutenberg-pinned-sha.outputs.sha }}-${{ hashFiles( 'tools/gutenberg/*', 'package*.json', 'Gruntfile.js' ) }}
- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install npm Dependencies
run: npm ci
- name: Build WordPress
run: npm run build
- name: Prepare the directory structure for the ZIP
run: mv build wordpress
- name: Create ZIP of built files
run: zip -q -r develop.zip wordpress/.
- name: Upload ZIP as a GitHub Actions artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: wordpress-develop
path: develop.zip
if-no-files-found: error