Developing WordPress Plugins in Github

As most of you know, I actively develop and main more than 20 WordPress Plugins. All of them are hosted in the official WordPress Plugin repository.

Until recently I was using the official WordPress repository’s svn to do the development. All my non-WordPress pet projects are hosted in my github account.

I was thinking of moving all my WordPress Plugins to github for quite sometime now, but didn’t do it thinking that it might involve huge effort to keep both the repos in sync.

After reading about how a couple of people moved (and didn’t face much problem afterwards), I decided to try it out for a couple of my Plugins. The following is what I did and in the end, figured out that it was worth the effort.

Github – more than just code

To be fair to official WordPress Plugin repository, there is nothing anything wrong with the way it works or with svn.

It is just that github as a platform is more suited if you are interested in collaboration and receiving contributions from users. It reduces the barrier to entry for people to contribute to projects and also it provides enough tools for project owners to easily merge (or reject) contributions from users.

I was more interested in this aspect of github rather than the ‘git’ part.

Using github for hosting WordPress Plugins

When I decided to move from svn to github, I wanted to do the following things.

  • I wanted to maintain the entire check-in history from svn. Some of my Plugins are more than 4 years old and have gone through lot of revisions and I didn’t wanted to loose them.
  • I also wanted to do the development in github (read doing atomic check-ins) and then upload to WordPress repository only when I tag the changes for release after testing them.
  • I also didn’t wanted to manually check-in in both the places to do the sync.

For the first I found that git-svn can fetch all the check-in history.

For the second and third point, keeping pragmatism in mind, I ended up creating shell scripts so that I don’t have to do anything manual.

Automation scripts

You can get the scripts that I wrote from my github account. The project consists of two scripts.

  • clone-from-svn-to-git.sh – Use this script to clone your WordPress Plugins from SVN into git/github
  • deploy-plugin.sh – Use this script to push your WordPress Plugin updates to SVN from gi/github

Right now the documentation is pretty sparse. I will fix it when I get some free time 🙂

Things to improve

The scripts pretty much do the job. Going forward, I want to improve the following to make it more useful.

  • The readme.txt file used by WordPress repository is not fully in markdown. Because of which the readme file displayed in github is slightly broken.
  • Ability to auto update the .pot file before releasing the new version
  • WordPress repository allows you to add a banner using the assests/ directory. Need to add support for that.

Update: All the above features are added. Check out the latest code in github.

Is it worth the effort?

So far I have moved the following Plugins to github. Will be moving the other ones as well when even I get some free time.

So now the real question. Is it worth the effort? It is worth every second that I spent on it.

You should check the pull requests I have received so far. I have received more contributions to my Plugins in the last couple of weeks than the last 5 years 🙂

If you are a WordPress Plugin developer, then try out my script and let me know if you have any feedback.

Related posts

Tags: , , , ,

4 Comments so far

Follow up comments through RSS Feed | Post a comment

  • Remco Tolsma says:

    “Ability to auto update the .pot file before releasing the new version”
    Maybe this comes in handy:
    https://gist.github.com/remcotolsma/5335793

    How do you use the “deploy-plugin.sh” file for all your plugins? I don’t see the file in your GitHub repostiories:
    https://github.com/sudar/bulk-delete

    “this file should be in the base of your git repository”

    Is it also possible to load the SVN ignore from a file ‘.svnignore’?

    • Sudar says:

      @Remco,

      “Ability to auto update the .pot file before releasing the new version”
      Maybe this comes in handy:
      https://gist.github.com/remcotolsma/5335793

      Thanks will have a look at it. I was also look at the code that is being used by WordPress.com http://codex.wordpress.org/I18n_for_WordPress_Developers#I18n_for_theme_and_plugin_developers

      How do you use the “deploy-plugin.sh” file for all your plugins? I don’t see the file in your GitHub repostiories:
      https://github.com/sudar/bulk-delete

      “this file should be in the base of your git repository”

      Actually, I have modified the way the deploy script. To use it, you don’t have to copy it to every Plugin directory. Instead, I just checkout https://github.com/sudar/wp-plugin-in-github to a directory and call it from that Plugin directory and pass the Plugin name as a command-line parameter.

      May be I should document it properly. It is in my ToDo list and will do it pretty soon 🙂

      Is it also possible to load the SVN ignore from a file ‘.svnignore’?

      I think it should be possible. But I have not tried it out yet.

      • Remco Tolsma says:

        Thanks for your reply.

        Is it also possible to load the SVN ignore from a file ‘.svnignore’?

        I think it should be possible. But I have not tried it out yet.

        I have tried, it is working, but i’m not sure if i’m gonna use it :P.

        SVN_IGNORE=$(<.svnignore)

        echo "[Info] Ignoring github specific files and deployment script"
        svn propset svn:ignore "README.md
        .git
        .gitignore
        $SVN_IGNORE" "$SVNPATH"

        • Sudar says:

          Yeah even I am not sure if I will use it 🙂

          But if you want, you can send me a pull request and I will be happy to merge it 🙂

3 Trackbacks/Pingbacks so far

Leave a Reply

Your email address will not be published. Required fields are marked *