Logo

dev-resources.site

for different kinds of informations.

Live demo of your WP Plugin with GH releases and WP Playground

Published at
1/4/2025
Categories
programming
wordpress
github
Author
artpi
Categories
3 categories in total
programming
open
wordpress
open
github
open
Author
5 person written this
artpi
open
Live demo of your WP Plugin with GH releases and WP Playground

I have been relying on Github actions to publish my plugins to the .org repositiory for some now. It feels magical – you publish a release and it builds, zips and uploads the plugin wherever it needs to go.

With WP Playground, you can take that process to another level – the moment you hit publish, new version of your plugin will be immediately available for testing right in browser, without installing and exposing existing sites. This means anybody can try out your plugin before downloading, without installing it with zero downsides, in seconds.

What is WordPress Playground?

Playground is a way to run an entire instance of WordPress in the browser, with no external backend. It is destroyed on reload, but perfect for trying out changes before installing on your site

Action to build plugin on release

I’m assuming you are using Github as a sane person. This Github action will run your plugin build process, zip it, and upload it as a release asset. Remember to change your zip file name.

name: Build and Upload Plugin ZIP
on:
  release:
    types: [published]

jobs:
  build-and-zip:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout Repository
      uses: actions/checkout@v4

    - name: Set up Node.js
      uses: actions/setup-node@v3
      with:
        node-version: 20 # Use Node.js v20

    - name: Install Node.js Dependencies
      run: npm install

    - name: Set up PHP and Composer
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.2' # Adjust PHP version as needed
        extensions: mbstring, zip

    - name: Install Composer Dependencies (Production Only)
      run: composer install --no-dev --optimize-autoloader

    - name: Build Plugin
      run: npm run build

    - name: Create Plugin ZIP
      run: npm run plugin-zip

    - name: Upload Release Asset
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ github.event.release.upload_url }}
        asset_path: ${{github.workspace}}/wp-personal-os.zip
        asset_name: wp-personal-os.zip
        asset_content_type: application/zip

Enter fullscreen mode Exit fullscreen mode

You will also have to make sure your package.json has npm scripts:

    "scripts": {
        "build": "wp-scripts build",
        "plugin-zip": "wp-scripts plugin-zip",
Enter fullscreen mode Exit fullscreen mode

Remember to give your Github actions write access:

Link to latest plugin zip

There is undocumented URL for the “release asset of the latest release” on Github:

https://github.com/USER/PROJECT/releases/latest/download/ASSET.zip
Enter fullscreen mode Exit fullscreen mode

Replace user, project and asset accordingly

Create your first release

Create your first Github release for the action to run

Your Playground Blueprint

With this link, you can now create a playground blueprint that will install the plugin to a temporary WordPress site that runs in the browser. You can also add additional steps that will create sample data for the best demo experience. Here is the very basic blueprint:

{
  "steps": [
    {
      "step": "installPlugin",
      "pluginData": {
        "resource": "url",
        "url": "https://github.com/USER/PROJECT/releases/latest/download/ASSET.zip"
      }
    }
  ],
  "login": true
}

Enter fullscreen mode Exit fullscreen mode

I highly recommend playground builder to work on these blueprints and debug them.

Once you have your blueprint, you can create a special link and drop it in the README of your plugin, like here

  1. Link will load playground
  2. It will install latest release of your plugin
  3. redirect the user to the proper page so they can see what your plugin is all about

The post Live demo of your WP Plugin with GH releases and WP Playground appeared first on Artur Piszek.

wordpress Article's
30 articles in total
Favicon
Struggling with WordPress Navigation Menu Issue in Development
Favicon
Fix 105 Common WordPress Issues Using Simple Code Snippets
Favicon
Access to Wordpress Website's Complete Codebase. Is it possible?
Favicon
Can a Website Be Hacked in Under 10 Minutes? Understanding Web Security
Favicon
Importance of Schema for SEO: Boosting Visibility with WordPress Themes and Gutenberg Plugins
Favicon
Why WordPress is the Best Platform for Website Development in 2025
Favicon
Author Bio Box CSS in WordPress
Favicon
Hiding WooCommerce Cart when empty by Enqueueing JavaScript
Favicon
A Step-by-Step Guide to Setting Up an E-Commerce Store on WordPress
Favicon
Reading Progress Bar
Favicon
Building Your WordPress Website: Custom Code or Page Builder?
Favicon
How to Use Google Search Console: A Comprehensive Guide
Favicon
How to Create a Digital Agency Website?
Favicon
How to Disable WordPress RSS Feeds
Favicon
What is digital proof?
Favicon
10 Things You Must Know Before You Hire WordPress Developers in India
Favicon
🌟Calling Dev Students🌟
Favicon
Easy Steps to Hire a WordPress Developer for Non-Tech Users
Favicon
WordPress and Webflow: Which Is Better
Favicon
Live demo of your WP Plugin with GH releases and WP Playground
Favicon
Benefits of Hiring Offshore Software Development Companies
Favicon
WordPress Security for 2025
Favicon
How to Track Plugins on WordPress.org?
Favicon
How to Schedule a Weekly Roundup of Gravity Forms Entries on Your Website
Favicon
How to Resolve the Theme File Editor Missing Error in WordPress
Favicon
Best website builders
Favicon
Cozy Blocks: The Ultimate Gutenberg Blocks Plugin & Page Builder for WordPress
Favicon
How to optimize your website loading speed
Favicon
Renew LetsEncrypt SSL Certificate in WordPress by Bitnami
Favicon
Top 5 WordPress Development Challenges and Effective Solutions

Featured ones: