Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/reusable-test-core-build-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ jobs:
- name: Ensure version-controlled files are not modified or deleted during building
run: git diff --exit-code

- name: Verify Gutenberg constants.php
if: ${{ inputs.directory == 'build' }}
run: |
echo "--- Gutenberg build output ---"
cat gutenberg/build/constants.php 2>/dev/null || echo "File not found in gutenberg/build/"
echo ""
echo "--- WordPress wp-includes/build/constants.php ---"
cat ${{ inputs.directory }}/wp-includes/build/constants.php 2>/dev/null || echo "File not found in ${{ inputs.directory }}/wp-includes/build/"

- name: Create ZIP of built files
if: ${{ inputs.directory == 'build' && contains( inputs.os, 'ubuntu-' ) }}
run: zip -r wordpress.zip build/.
Expand Down
23 changes: 15 additions & 8 deletions tools/gutenberg/build-gutenberg.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,22 @@ async function main() {
const startTime = Date.now();

try {
// On Windows, shell mode is used and needs the argument wrapped in quotes
// On Unix, arguments are passed directly without shell parsing
const baseUrlArg =
process.platform === 'win32'
? '--base-url="includes_url( \'build/\' )"'
: "--base-url=includes_url( 'build/' )";

await exec( 'npm', [ 'run', 'build', '--', '--skip-types', baseUrlArg ], {
// Invoke the build script directly with node instead of going through
// `npm run build --` to avoid shell argument mangling of the base-url
// value (which contains spaces, parentheses, and single quotes).
// The PATH is extended with node_modules/.bin so that bin commands
// like `wp-build` are found, matching what npm would normally provide.
const binPath = path.join( gutenbergDir, 'node_modules', '.bin' );
await exec( 'node', [
'bin/build.mjs',
'--skip-types',
"--base-url=includes_url( 'build/' )",
], {
cwd: gutenbergDir,
env: {
...process.env,
PATH: binPath + path.delimiter + process.env.PATH,
},
} );

const duration = Math.round( ( Date.now() - startTime ) / 1000 );
Expand Down
Loading