forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.7 KB
/
reusable-build-package.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
##
# 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.
# - 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.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@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: wordpress-develop
path: develop.zip
if-no-files-found: error