One of the things I love about WordPress is the plugin architecture, as it allows users to contribute and extend WordPress without compromising the sanity and clarity of its core.
Whenever I write a plugin I tend to submit it to the official plugin repo, where it can quickly be downloaded and used by thousands of savvy users. I also often host my plugins on GitHub too; either because I’m still developing them and I’m not quite ready to release them to the world or simply because it might be a client-specific or commercial plugin. In those cases I always feel shorthanded when I see other plugins receive new update notifications and the ones on GitHub have to be updated manually.
However, with some recent code by Joachim Kudish, pushing new releases of these plugins on GitHub has become a lot easier, as it allows me to seamlessly combine official plugins with commercial ones and to update them in one go. Every time I decide to release a new version, I just need to tag the release and the plugin will get a “new release available” message on the user’s admin panel. I have tried it out and it’s fairly easy to setup.
It’s available via a class we must include in the plugin to support GitHub updates. Download it and put the updater.php (source) into the plugin directory that you will want to auto update and make sure that the plugin includes the file:
The next step is to initialize the class. You can do this by adding:
In your Github repository, you will need to include the following line (formatted exactly like this) anywhere in your Readme file:
You will need to increment the version number whenever you update the plugin, as this will ultimately let the plugin know that a new version is available. Once the plugin finds it has an update, it downloads a zip file from GitHub, eliminating the need for git installed on the server.
It used to be the case where this would only work with GitHub public repositories, but about 4 months ago Paul Clark stepped in and started working on support for private repos through Github oAuth tokens. He says it’s functionally complete and I’ll definitely give it a try (Issue #15).
I’m quite excited with this updater class and I think plugin developers should seriously consider integrating it into their workflow because it makes things a lot easier.
I, for one, know I’ve impressed a few clients already.