Deploying WordPress themes via GitHub with CircleCI

A lot of marketing sites are built on WordPress these days, which makes a lot of sense. It’s a powerful CMS with an enormous ecosystem. Everything from blogs to e-commerce to real estate sites are powered by it. It should come as no surprise that we use WordPress here at Sprintly as well. We use and very much love Pagely to power our WordPress blog. They have an amazing infrastructure and keep our installation of WordPress up-to-date and secure.

That being said, we still have to keep our theme updated (despite stellar customer service, we are expected to do some of the work). Thankfully, unlike some WordPress hosts, they offer SFTP access. Throw in a little BASH script, CircleCI, and GitHub, and we can let the robots handle the boring aspects for us. The basic recipe goes like this:

Submit a pull request (PR) with proposed changes to your theme.

PR is approved and merged into master.

CircleCI kicks off and deploys the them via SFTP.

Below are the two important bits:

circle.yml – This is a configuration file that tells CircleCI to only deploy our theme when we merge to master.

deploy-theme.sh – This is a BASH script that uses lftp to sync the theme in GitHub to our WordPress site via SFTP.

Once you have the code wired in, it’s just a matter of merging a PR into master. Sit back and let the robots do the rest!