Writing plugins for yourself or others is a natural step for a developer that uses WordPress. Unfortunately if you want to share your plugins with the WordPress community that means submitting them to the WordPress plugin repository and there is one really sucky part about that – learning Subversion.
Subversion, or SVN, was great years ago when Git didn't exist. But since the emergence of GitHub, Git has become hugely popular and produces far fewer headaches than SVN. As a result new developers don't even bother learning SVN. Why learn to drive a stick shift when you can drive an automatic that has better gas mileage and more control?
With a lot of googling and several hacking sessions I took an existing shell script and modified it so that is does all of the cumbersome SVN for you. It will pull down the latest version of your Git repo, reproduce it in SVN, and push the changes to the WordPress plugin repository. It will even move your plugin assets (including the header image and screenshots) to the appropriate spot in the SVN repo.
The new workflow using this deploy script is:
- Write awesome code
- Put the deployment script in the root of your repo
- Enter your WordPress username & location of your repo
- Deploy using a one line command in the terminal. ‘bash deploy.sh'
Does it require any knowledge of SVN? Nope. All you have to do is enter your WordPress.org credentials, your plugin name, and the location of your plugin repo. This script takes care of the rest.
If you want to include screenshots & a header image for the WordPress plugin repo you just have to put them into a assets-wp-repo directory at the root of your repo. Then the script will move them into the right location for you.
By the way, feel free to keep this deployment script in a public repo. There aren't any passwords saved and storing it in the repo it makes it far easier to deploy from any computer.
In the Wild
If you want to see a plugin that uses this script feel free to look at my JotForm Integration plugin in GitHub (with the deployment script) and in the WordPress Plugin Repository (with the assets saved in the right spot).
I, of course, did not do this all by myself – it's the Internet for God's sake. Brent Shepherd made some modifications on Dean Clatworthy's original script. Chris Schmitz and Jon Kinney helped me stumble through SVN.