From d1e7f8b6008978d393d2b5a4306f681c433bfcbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Sun, 19 May 2024 00:33:20 +0200 Subject: [PATCH] WordPress PR Previewer: simplify the Blueprint Replaces a series of custom steps meant to unzip and configure WordPress with passinf the build zip as a preferredVersion. To test, go to the WordPress PR previewer locally and try previewing one of the recent PRs. Confirm the installed WordPress versions is indeed not the latest stable. Do not merge until these PRs are merged: * #1423 * #1424 * #1425 * #1426 * #1427 --- .../playground/website/public/wordpress.html | 65 ++----------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/packages/playground/website/public/wordpress.html b/packages/playground/website/public/wordpress.html index 6353c1be55..7c7716be9f 100644 --- a/packages/playground/website/public/wordpress.html +++ b/packages/playground/website/public/wordpress.html @@ -144,7 +144,7 @@ } // Verify that the PR exists and that GitHub CI finished building it - const zipArtifactUrl = `/plugin-proxy.php?org=WordPress&repo=wordpress-develop&workflow=Test%20Build%20Processes&artifact=wordpress-build-${prNumber}&pr=${prNumber}`; + const zipArtifactUrl = `https://playground.wordpress.net/plugin-proxy.php?org=WordPress&repo=wordpress-develop&workflow=Test%20Build%20Processes&artifact=wordpress-build-${prNumber}&pr=${prNumber}`; // Send the HEAD request to zipArtifactUrl to confirm the PR and the artifact both exist const response = await fetch(zipArtifactUrl + '&verify_only=true'); if (response.status !== 200) { @@ -205,64 +205,11 @@ $schema: 'https://playground.wordpress.net/blueprint-schema.json', landingPage: urlParams.get('url') || '/wp-admin', - steps: [ - { - step: 'mkdir', - path: '/wordpress-new', - }, - /* - * Download WordPress build from a given GitHub PR. - * - * Because the zip file is not publicly accessible, we use the - * plugin-proxy API endpoint to download it. The source code of - * that endpoint is available at: - * https://github.com/WordPress/wordpress-playground/blob/trunk/packages/playground/website/public/plugin-proxy.php - */ - { - step: 'writeFile', - path: '/tmp/pr.zip', - data: { - resource: 'url', - url: zipArtifactUrl, - caption: `Downloading WordPress PR ${prNumber}`, - }, - }, - // Extract and remove the zip file. - { - step: 'unzip', - zipPath: '/tmp/pr.zip', - extractToPath: '/tmp', - }, - { - step: 'rm', - path: '/tmp/pr.zip', - }, - // Import the unzipped PR. - { - step: 'importWordPressFiles', - wordPressFilesZip: { - resource: 'vfs', - path: '/tmp/wordpress.zip', - }, - pathInZip: '/build', - progress: { - weight: 20, - caption: `Applying WordPress PR ${prNumber}`, - }, - }, - { - step: 'runPHP', - code: `