Skip to content

Commit

Permalink
Refresh WordPress with the latest SQLite integration plugin (#1151)
Browse files Browse the repository at this point in the history
Brings the PHP 7.0 compat fix from
WordPress/sqlite-database-integration#81 into
Playground by rebuilding the WordPress archives. Also, adds a "force"
input to GitHub action to enable doing that directly from the UI even
when the WP releases haven't changed recently.
  • Loading branch information
adamziel authored Mar 29, 2024
1 parent b8be003 commit feee461
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/refresh-wordpress-major-and-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: 'Refresh WordPress Major&Beta'

on:
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force rebuild of WordPress (true/false)'
required: false
default: 'false'
# Every 20 minutes
schedule:
- cron: '*/20 * * * *'
Expand Down Expand Up @@ -32,6 +37,8 @@ jobs:
- uses: ./.github/actions/prepare-playground
- name: 'Recompile WordPress'
shell: bash
env:
FORCE_REBUILD: ${{ github.event.inputs.force_rebuild }}
run: npx nx bundle-wordpress:major-and-beta playground-wordpress
- name: Check for uncommitted changes
id: changes
Expand Down
21 changes: 9 additions & 12 deletions packages/playground/wordpress/build/build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import path from 'path';
import { spawn } from 'child_process';
import yargs from 'yargs';
import { promises as fs, statSync } from 'fs';

const parser = yargs(process.argv.slice(2))
.usage('Usage: $0 [options]')
.options({
Expand All @@ -22,6 +22,11 @@ const parser = yargs(process.argv.slice(2))
description: 'WordPress static files output directory',
required: true,
},
force: {
type: 'boolean',
description: 'Force rebuild even if the version is already downloaded',
default: process.env.FORCE_REBUILD === 'true',
},
});

const args = parser.argv;
Expand Down Expand Up @@ -83,7 +88,7 @@ const sourceDir = path.dirname(new URL(import.meta.url).pathname);
const outputAssetsDir = path.resolve(process.cwd(), args.outputAssets);
const outputJsDir = path.resolve(process.cwd(), args.outputJs);

// Short-circuit if the version is already downloaded
// Short-circuit if the version is already downloaded and not forced
const versionsPath = `${outputJsDir}/wp-versions.json`;
let versions = {};
try {
Expand All @@ -95,15 +100,11 @@ try {
versions = {};
}

// We don't get granular version info for nightly, so we always download it.
// Otherwise, we only download if the version is not already the latest one
// in the repository.
if (versionInfo.slug !== 'nightly' && versions[versionInfo.slug] === versionInfo.version) {
process.stdout.write(`The requested version was ${args.wpVersion}, but it's latest release (${versionInfo.version}) is already downloaded\n`);
if (!args.force && versionInfo.slug !== 'nightly' && versions[versionInfo.slug] === versionInfo.version) {
process.stdout.write(`The requested version was ${args.wpVersion}, but its latest release (${versionInfo.version}) is already downloaded\n`);
process.exit(0);
}


// Build WordPress
await asyncSpawn(
'docker',
Expand Down Expand Up @@ -131,8 +132,6 @@ await asyncSpawn(
'-v',
`${outputAssetsDir}:/output`,
'wordpress-playground',
// Use sh -c because wildcards are a shell feature and
// they don't work without running cp through shell.
'sh',
'-c',
`cp -r /root/output/wp-${versionInfo.slug} /output/`,
Expand All @@ -151,8 +150,6 @@ await asyncSpawn(
'-v',
`${outputJsDir}:/output`,
'wordpress-playground',
// Use sh -c because wildcards are a shell feature and
// they don't work without running cp through shell.
'sh',
'-c',
`cp /root/output/*.zip /output/`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,35 @@ export function getWordPressModuleDetails(wpVersion: string = "6.4"): { size: nu
case 'beta':
/** @ts-ignore */
return {
size: 5127315,
size: 5127314,
url: url_beta,
};

case '6.4':
/** @ts-ignore */
return {
size: 5015127,
size: 5015110,
url: url_6_4,
};

case '6.3':
/** @ts-ignore */
return {
size: 3760149,
size: 3760135,
url: url_6_3,
};

case '6.2':
/** @ts-ignore */
return {
size: 3654394,
size: 3654384,
url: url_6_2,
};

case '6.1':
/** @ts-ignore */
return {
size: 3533948,
size: 3533940,
url: url_6_1,
};

Expand Down
Binary file modified packages/playground/wordpress/src/wordpress/wp-6.1.zip
Binary file not shown.
Binary file modified packages/playground/wordpress/src/wordpress/wp-6.2.zip
Binary file not shown.
Binary file modified packages/playground/wordpress/src/wordpress/wp-6.3.zip
Binary file not shown.
Binary file modified packages/playground/wordpress/src/wordpress/wp-6.4.zip
Binary file not shown.
Binary file modified packages/playground/wordpress/src/wordpress/wp-beta.zip
Binary file not shown.

0 comments on commit feee461

Please sign in to comment.