About a month ago, I got my Sift Science plugin added to the WordPress.org online store. To publish your plugin to the store, you’re required to use the SVN repository that they provide. Once you get that done correctly, users of WordPress can find and install your plugin through the built in store and they will also receive notifications whenever you publish a new version.
In this post, I describe how I manage releases of my Sift Science plugin. The information here should be useful for many different types of plugins, but it specifically addresses two key issues I faced when getting started with this:
- I develop my plugin primarily in Git
- My plugin has a React component that must be packaged with the plugin
So let’s get started!
Getting your WordPress.org Plugin Published
You’ll need to request WordPress.org hosting for your plugin. You’ll have to make sure your plugin conforms to the requirements listed there and follow the instructions to provide the required information.
Checkout Git and SVN Trunk Together
I keep my Git repository synced with the trunk directory in SVN. On my computer I have checked out both Git and SVN trunk into the same directory, which helps keep them in sync quite easily. It can be a little tricky to setup initially, but the basic commands to do this are:
git clone [git repo address] svn checkout [repo]/trunk svn revert -R .
I do all of my development in Git, with detailed commit messages and so on. Then, when I’m ready to sync SVN with Git, I’ll pull the latest changes from Git (
git pull) and check those changes into SVN trunk (
svn ci ...).
Git vs SVN Ignored Files
For most plugins, SVN and Git will probably have identical ignores. However, since I have a React app that needs to be web-packed for deployment, my SVN and Git ignores are slight different. In my case, I drop the web-packed React app into the
/dist folder of my project. Naturally, since this is “compiled from code”, the folder is ignored in Git. However, I don’t ignore this in SVN, since I want to ship that file to my users.
Update The Plugin’s Documentation
When you have a new version that you want to push to your users, you’ll want to update the documentation as follows:
- Update “stable tag” entry and the change log in
- Update to the version number in your plugin’s main php file (`Version: x.y.z`)
Be sure to sync these changes into your SVN trunk folder.
Tag the new Version
The final step to getting your update shipped is to create a new entry in the tags folder. You do this by executing
svn copy trunk tags/x.y.z and checking that change in. The version number in the tag must match the version number in your main php file for this to work.
And there you have it! A general outline of how to work in Git while shipping to a WordPress.org SVN repository.