This is a copy-paste GitHub action to deploy your WordPress plugin from GitHub to the WordPress.org repository and absolutely no change in the code is necessary.
The plugin will be automatically deployed on creating a release (tag) on GitHub. You’ll not need to commit to SVN manually, anymore.
Configuration
1) Create a “plugin-deploy.yml” file making this structure in your plugin folder: “plugin-name/.github/workflows/plugin-deploy.yml”. Basically, create a folder “.github”, create a folder “workflows” inside .github, and a file “plugin-deploy.yml” under workflows.
2) Create a “plugin-update.php” file similar to the “plugin-deploy.yml” file making this structure in your plugin folder: “plugin-name/.github/workflows/plugin-update.yml”
Example of folder structure for “wp-force-logout” plugin:
Note that the “plugin-deploy.yml” file is for the automatic deployment on the tag while the “plugin-update.yml” file is for updating the plugin assets such as screenshots, icon, banner, etc. on push on the master branch.
3) Copy and paste the following code in the “plugin-deploy.yml” file:
name: Deploy to WordPress.org
on:
push:
tags:
- "*"
jobs:
tag:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install dependencies
uses: php-actions/composer@v6
with:
version: 1
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
4) Copy and paste the following code in the “plugin-update.php” file
name: Plugin asset/readme update
on:
push:
branches:
- main
jobs:
master:
name: Push to master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: WordPress.org plugin asset/readme update
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
5) Create a new folder “.wordpress-org” in your plugin directory and add assets such as banner, icon, screenshots. The naming format should be banner-772×250.jpg, icon-256×256.jpg, screenshot-1.png, screenshot-2.png. So, the file structure would be “your-plugin/.wordpress-org/banner-772×250.jpg”
6) Push these changes to your GitHub repository.
7) Go to your GitHub repository > Settings > Secret.
7) Create two secrets: SVN_USERNAME and SVN_PASSWORD which are your WordPress.org username and password respectively.
8) Make sure to update the plugin readme, plugin version, tag, etc.
9) Create a GitHub release.
10) Enjoy the automatic deployment!
Note that your repository name should match the plugin slug. Your repository name is different from your plugin slug? No problem. Just add SLUG: plugin-name below SVN_PASSWORD in both the files above. So that the structure would be:
...
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: plugin-name
Problems? You can check out both the files in action in the WPForce Logout GitHub Repository