Deployment on test and demos

About our demos

Each of our WordPress themes and their features are presented in a nice way on our multi-site WordPress setup at https://demos.pixelgrade.com/julia. Each demo is a single installation here for a better encapsulation and management.

The files for this entire website are provided by this GitHub repository. This means that every time a commit is pushed to the master branch this repository the changes will be immediately applied to the server.

Because it is never a good idea to push development code in production we've also built a staging mode of the exact same setup.  The stagging can be modified on the same repository on the test branch and it can be seen at https://test.demos.pixelgrade.com/julia

Update flow

In order to keep the demos safe and working it is very important to keep the themes and the plugins up to date.

The main rule of each update is that we always have to update in the test environment first, check if all the things are still working as it should and only if we are definitely sure that we didn't break anything, then we can push the same changes in production.

Gulp and automatic deployments

Because all the manual tasks are time-consuming we built an automatic way of deploying theme updates on our demos and these scripts are available in this GitHub repository along with the installation instructions.

Once a theme has the deployment scripts installed, all you need is to use the gulp update-demo  command and a prompt message will ask you which environment you want to deploy in, test or demo.

Deployment flow

The deployment flow could be described in these steps:

  1. Once you hit gulp update-demo the task will commit all the changes in the selected branch, test or demo.
  2. CircleCI will always listen to these two branches and every commit will run the phpUnit tests
  3. If the tests are green, then the actual deployment will be triggered. This means that the entire theme code will be committed to the demo repository, in the /wp-content/themes/{theme_name} folder.
  4. If there isn't a conflict, and everything went well, the changes should already be live. To be sure about it, you can check commit the queue in the Multi-Site Network Dashboard -> Gitium -> Status

Notifications

CircleCI can notify a Slack channel if a a build was successful or not.

 This integration can be made with a Slack incomming webhook. You only have to create a webhook for a theme channel and simply copy the webhook URL in CircleCI -> Theme Project -> Settings -> Notifications -> Chat Notifications -> Slack.