Lately I have been working on quite a few WordPress plugins that are hosted in the WordPress.org plugin repository, and since Github is my go to version control system, I like it a lot and we use at WooThemes as well, I got a bit fed up with having to keep a local SVN copy and doing things manually.
After some googling I eventually found a bash script that enables you to deploy directly from your Github repository without the need to keep a local copy of the SVN repository, it is as simple as adding the script below to your Github repo, changing a few lines in the script and then executing it when you want to deploy to the WordPress.org plugin repository/
I take no credit for this script, in fact it was created by a fellow WooCommerce plugin developer, Brent Shepherd, he developed and maintains the awesome WooCommerce Subscriptions extension.
To deploy straight from your Github repository to your WordPress.org Plugins SVN repository, simply copy the bash script below and place it in a new file in your Github repository, I use deploy.sh, once the file is there you can commit it to Github so it is always part of your plugin, then open up the file and edit the following parameters.
PLUGINSLUG – Change this to the slug of the plugin on WordPress.org
MAINFILE – Change this to the main PHP file that contains the WordPress version number of the plugin
SVNUSER – Change this to the WordPress.org username of the user who owns the plugin, it will be commit under this user.
And that is it, once you have modified the file, you will have to make it executable by (
chmod u+x deploy.sh) it via terminal, then when you are ready to deploy it, go to your Github repository where you stored the deploy.sh file and run the following command via terminal
It will ask you a few questions along the way and do some checks as well as tag the version on Github for you.