10up / convert-to-blocks

Convert to Blocks is a WordPress plugin that transforms classic editor content to blocks on the fly.
https://wordpress.org/plugins/convert-to-blocks/
GNU General Public License v2.0
154 stars 20 forks source link

Add support for the WordPress.org plugin preview #149

Closed dkotter closed 11 months ago

dkotter commented 11 months ago

Description of the Change

WordPress.org recently launched support for plugin previews utilizing the WordPress Playground feature. Plugins wanting to take advantage of this need to opt in by setting up a blueprint.json file that configures how the preview should load. This PR adds in that file that does the following:

  1. Sets up an environment running PHP 8.0 (our supported minimum) and the latest version of WordPress
  2. Logs into the admin
  3. Imports some test content
  4. Installs and activates the plugin
  5. Sends the user to the posts list screen where they can click into a Classic Editor post to see the conversion

Note that this PR is targeted to trunk as the hope is we can take advantage of our Plugin Asset Update Action to deploy these changes without having to push out a new release. This PR also updates our Asset Deploy workflow to hopefully avoid issues related to differing files on Github as compared to .org.

Also note once these changes are on .org, the preview button will need to be enabled in a test state. Once verified as working, we can enable it for all users.

How to test the Change

The WordPress Playground allows you to spin up a new environment directly through the URL, by going to https://playground.wordpress.net/# and pasting your JSON config after the #. In this case, the URL should be: https://playground.wordpress.net/#{%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin/edit.php?post_type=post%22,%22preferredVersions%22:{%22php%22:%228.0%22,%22wp%22:%22latest%22},%22phpExtensionBundles%22:[%22kitchen-sink%22],%22steps%22:[{%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22},{%22step%22:%22importFile%22,%22file%22:{%22resource%22:%22url%22,%22url%22:%22https://raw.githubusercontent.com/WordPress/theme-test-data/42c0fdc29d0055c276fc9fdd335a672a8133c605/theme-preview.xml%22}},{%22step%22:%22installPlugin%22,%22pluginZipFile%22:{%22resource%22:%22wordpress.org/plugins%22,%22slug%22:%22convert-to-blocks%22},%22options%22:{%22activate%22:true}}]}

Changelog Entry

Added - Support for the WordPress.org plugin preview

Credits

Props @dkotter

Checklist: