Skip to content

Commit 0423b19

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 0391e67 + 80fb78d commit 0423b19

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
##
2+
# A reusable workflow that downloads and verifies the Gutenberg build once per
3+
# calling workflow run.
4+
##
5+
name: Prepare Gutenberg build
6+
7+
on:
8+
workflow_call:
9+
outputs:
10+
gutenberg-sha:
11+
description: 'The immutable Gutenberg source SHA verified by this workflow.'
12+
value: ${{ jobs.prepare-gutenberg.outputs.gutenberg-sha }}
13+
14+
# Disable permissions for all available scopes by default.
15+
# Any needed permissions should be configured at the job level.
16+
permissions: {}
17+
18+
jobs:
19+
prepare-gutenberg:
20+
name: Gutenberg
21+
runs-on: ubuntu-24.04
22+
timeout-minutes: 10
23+
outputs:
24+
gutenberg-sha: ${{ steps.download.outputs.gutenberg-sha }}
25+
permissions:
26+
contents: read
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
31+
with:
32+
# Resolve the Gutenberg ref from the exact commit that started this workflow run.
33+
ref: ${{ github.sha }}
34+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
35+
persist-credentials: false
36+
37+
- name: Set up Node.js
38+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
39+
with:
40+
node-version-file: '.nvmrc'
41+
42+
- name: Download and verify Gutenberg build
43+
id: download
44+
run: |
45+
node tools/gutenberg/download.js
46+
gutenberg_sha="$(tr -d '\n' < gutenberg/.gutenberg-hash)"
47+
if [[ ! "$gutenberg_sha" =~ ^[a-fA-F0-9]{40}$ ]]; then
48+
echo "Expected a 40-character Gutenberg SHA, received: $gutenberg_sha" >&2
49+
exit 1
50+
fi
51+
echo "gutenberg-sha=$gutenberg_sha" >> "$GITHUB_OUTPUT"
52+
53+
- name: Upload Gutenberg build
54+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
55+
with:
56+
name: gutenberg-build
57+
path: gutenberg/
58+
if-no-files-found: error
59+
include-hidden-files: true
60+
retention-days: 1

0 commit comments

Comments
 (0)