If you create plugins and themes for clients and host them on GitHub, then you may have encountered the hassle of having to move those files over to your client’s installation. On super cheap hosting packages, where SSH access is not an option, this process inevitably requires manually copying files over via FTP.
This is the problem that Danish developer Peter Suhm aims to solve with his new WP Pusher product. The plugin aims to bring pain-free deployment of WordPress themes and plugins directly from GitHub and Bitbucket.
“If you happen to be an actual developer, I guess you have a few preferences as to how you manage and deploy your code,” Suhm said. “I’m talking about stuff like version control and automated deployment scripts. Good luck with that on your clients’ cheap-ass shared hosting account.”
Suhm developed WP Pusher with the vast majority of cheaply-hosted WordPress sites in mind. Additionally, he wanted to eliminate some of the hangups with more expensive hosts. “Even if you are running a shiny new VPS and have SSH access, Git installed and you think all is well, soon you’ll realize other weird things,” he said. “You can’t have symlinks in your /plugins folder just to mention one.” WP Pusher gets around these limitations via a simple plugin that does not require Git or SSH.
How Does WP Pusher Work?
Once installed, WP Pusher allows you to install and manage all of your GitHub or Bitbucket-hosted plugins in one central dashboard in the admin. Enabling the Push-to-Deploy feature will have your code update itself automatically every time you push to GitHub or Bitbucket.
The plugin supports private repositories in its free edition and includes support for branches in the Pro version.
WP Pusher is essentially an extension of the built-in auto updater in WordPress, which Suhm explained in the plugin’s release post:
After a lot of prototyping, and hacking around with the WordPress core, we came up with a smart solution. By utilizing the WordPress core upgrader classes, we could solve the problem in a really clean way.
Since WordPress already knows how to pull stuff from a remote source and install it, we realized that by working together with WordPress, instead of just throwing random automated SSH and FTP scripts at the server, we could just have WordPress do the work for us -with a lot of tweaking of course. In the end, our solution doesn’t do anything that is not native to WordPress. It’s all core functionality.
WP Pusher does everything in the plugin and does not require shell access. It communicates with GitHub via a token stored on your server and operates using WordPress’ core updater capabilities.
Different Approaches to Managing WordPress Projects with Git
In order to use WP Pusher, each GitHub-hosted plugin and/or theme will need to be in its own repository. While beta testing WP Pusher, Suhm found that developers have differences in how they manage WordPress projects with Git. The most common one he’s encountered is one installation, one repository, where the entire WordPress installation, including themes and plugins, is under Git control. Suhm believes that this approach is fundamentally broken, given that it requires you to keep a lot of 3rd party code under version control.
WP Pusher operates under a “one package, one repository” approach where each theme or plugin is its own entity. This method also offers the advantage of being able to share theme/plugin code across multiple projects.
“WordPress relies heavily on the auto updater, which would make your version control a mess,” Suhm explained. “If you do have something that is more enterprise than most WordPress setups, you should consider a custom setup that allows better for version control of core. Packages should still, in my opinion, each have their own repositories, since they are logically their own entities.”
WP Pusher is structured around this approach for managing WordPress projects with Git. You may need to restructure some of your repositories if you want to be able to use the plugin.
The free version offers unlimited themes and plugins, unlimited repositories, and support for both GitHub and Bitbucket. It does not, however, include email support. WP Pusher is compatible with WordPress multisite and will show up in the network admin when activated. It doesn’t currently support Composer but Suhm is considering adding it in the future. The plugin is released under the GPLv2 license.
WP Pusher offers a unique take on maintaining version control for projects while not forcing WordPress to bend over backwards to provide it in the admin. It leaves the version control to GitHub and/or Bitbucket and uses WordPress simply for deployment.
Setup is simple and the plugin will work virtually everywhere, even on the cheapest hosting. If you like the idea of maintaining version control on a plugin/theme basis, you can download the WP Pusher plugin for free from the project’s website.