- gustavo's personal blog

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).


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


mkdir $TMP_DIR
svn co $TMP_DIR
cd $TMP_DIR/trunk
git clone --recursive tmp
cp -r tmp/* .
rm -rf tmp
rm -rf .git*
version=`head -n 1 VERSION`
svn add trunk/* --force
svn ci -m "Release $version"
svn cp trunk tags/$version
svn ci -m "Tagging version $version"
rm -rf $TMP_DIR