How to publish a Wordpress plugin from Github

Wordpress plugins are hosted in a Subversion repository, and there’s no way to change that. Personally, I don’t like SVN (though it has it uses), and I prefer to use git over it.

Recently, I had to develop a small Wordpress plugin (which is called Comment Reply Email Notification), and I decided to host it on Github. To publish it to Wordpress, I wrote a small script that copies the plugin files from the git repository to the SVN repository, creates a release tag and effectively releases a new version of the plugin in Wordpress’ official plugin platform.

To use this script, replace the SVN and git repository URLs, and make sure you have an up-to-date VERSION file (preferably using Semantic Versioning rules).

#!/bin/sh

# The script updates the Wordpress.org SVN repository after pushing
# the latest release from Github

BASE_DIR=`pwd`
TMP_DIR=$BASE_DIR/tmp

mkdir $TMP_DIR
svn co http://plugins.svn.wordpress.org/comment-reply-email-notification/ $TMP_DIR
cd $TMP_DIR/trunk
git clone --recursive https://github.com/guhemama/worpdress-comment-reply-email-notification.git tmp
cp -r tmp/* .
rm -rf tmp
rm -rf .git*
version=`head -n 1 VERSION`
cd $TMP_DIR
svn add trunk/* --force
svn ci -m "Release $version"
svn cp trunk tags/$version
svn ci -m "Tagging version $version"
rm -rf $TMP_DIR

I used to have Disqus enabled on my website, but I have disabled it because of privacy concerns.

If you feel like commenting or asking something, you can still contact me via other means.