I’ve published by first free WordPress plugin on WordPress.org plugin repository back in 2013, almost 8 years from now. Since then, My updates to plugins were not regular at all, the only reason is there was so much additional work to release every single update of the plugin. I needed to copy the files over to somewhere in svn folder and then copy to a tag folder etc. And if I wanted to maintain a git repository, that needed to be maintained totally separately. Lots of pain and additional work meant to me.
However, recently I’ve discovered an action that makes this process very simple by integrating with Github repo. The action pushes each tags I release to a new tag on wordpress.org without requiring any single additional step every time a version is released. What I need to do is setup the action once (which is also very simple) and it will do its job for lifetime. A true life saver.
So, here’s the Github action in question: WordPress.org Plugin Deploy by 10up
In this article, I am going to share step by step instructions on how you can set up this action on your wordpress plugins to eliminate extra work for releasing new versions on wordpress.org plugin repo. I’ve faced little difficulties setting it up for the first time using their sample code, that’s why I thought about writing this post.
Setup Repository Secrets
Go to your github repository and navigate to Settings > Secrets menu. Add a repository secret for SVN_USERNAME & another for SVN_PASSWORD . Value for SVN_USERNAME is your wordpress.org username, value for SVN_PASSWORD is your wordpress.org password.
Setup Repository Files
Your plugin files can be on the root of the repository. you can think of it as your trunk folder as well if you’re used to using svn repos. Additionally you need to create a new folder called .wordpress-org . This is the folder where you’ll be put your asset files like banners, icons. screenshots etc.
Create Workflows
Add a new file in .github/workflows called main.yml . You can use any other name instead of main . Put the following code in that file and save.
name: Deploy Plugin to WordPress.org
on:
push:
tags:
- "*"
jobs:
tag:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
Once you commit the changes to this file, your repository is ready to be pushed to wordpress.org repo whenever you push a new tag to the repository.
You can take a look at one of my plugin’s github repo for example: PDF Viewer by ThemeNcode
Test if its working
You can test by adding a tag to your repo and pushing it to github. Example command is given below just FYI. don’t forget to replace version number with your plugin version.
git tag 1.0.5
git push --tags
Once you push using the command above, the action will run and the new version will be live on wordpress.org within a few minutes.
Updating only readme or plugin assets
The action above pushes only the new releases, what if you just want to make small update to readme.txt file or change screenshots, banners etc? There’s another action for this task. That action is called WordPress Plugin Readme/Assets update
This action will only run when there are changes in readme.txt file or inside .wordpress-org folder. It won’t run if you have made changes on other files as well (such as main plugin file).
Setup the action
This is similar to the Plugin Deploy action above. You don’t have re-setup the repository secrets if you’re using the WordPress Plugin Deploy action already. If you’re not using that action, you need to setup the repository secrets for SVN_USERNAME and SVN_PASSWORD like shown above.
If you have the repository secrets set up, create a file in the following location .github/workflows/ called assets.yml . You can name it to some other name as well.
Put the following code in the file:
name: WordPress Plugin asset/readme update on: push: branches: - trunk jobs: trunk: name: Push to trunk 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 }}
Make sure to replace – trunk on line 4 to your main branch name. My main branch name is trunk.
That’s it, now whenever you push changes to only readme or .wordpress-org folder, it will automatically update the files on your wordpress.org plugin repository.
That’s all for today, please feel free to ask any questions if you have in the comment section below or using the contact form on my homepage.