Continuous Integration with Branch

Branch is a continuous integration and deployment platform, designed to help automate deployments to your WordPress website from Git.

Branch makes it easy to deploy your code to WP Engine from GitHub, Bitbucket or Gitlab. Connect Branch to your WP Engine account using API credentials and Branch will use its built-in tools to automate your deployment workflow to WP Engine.

Sign up with Branch

Signing up to use Branch is free and only requires a GitHub, Bitbucket or GitLab account.

Once you have a Branch account, you can do 20 deployments for free every month, with the option to upgrade to a paid plan for an unlimited amount.

Sign up with Branch here.

Set Up a New Branch Project

After signing up with Branch, you will automatically be prompted to select an existing project repo.

You can connect Branch to any Git repository containing a theme, a plugin, a full WordPress site, or any combination of the above. With WP Engine, you can keep either an entire WordPress project in the repository or just a theme or plugin.

After selecting a project, Branch will set up the connection to your Git provider with the following steps automatically:

  1. Adding an SSH key associated with the project. This lets Branch clone the repository.
  2. Adding a webhook to the repository. This lets Branch know when there are new commits and pull requests to build.

Once your new Branch project has been created, you will be redirected to the project configuration screen on your Branch dashboard.

This dashboard is where you’ll add any build, test and deployment steps. This is also where you can add (secret encrypted) variables to your Branch build environment and where you can manage the settings for your project.

To use any of these items, you’ll first need to connect Branch with WP Engine in the next step.

Connect Branch to WP Engine

Branch has a native integration with WP Engine, which means that by providing a set of API credentials for WP Engine, Branch can automatically provision the integration with WP Engine. Branch will automatically add your project SSH key to your WP Engine account and set up a few environment variables to use in your build steps.

  1. Log into the WP Engine User Portal
  2. Click your name, at the top right
  3. Select My Profile
  4. Click API Access
  5. Use the button Generate Credentials, at the top right
  6. Once you have your API credentials for WP Engine, simply copy and paste these into Branch
  7. Click Connect
  1. Select the WP Engine Site you want to connect with Branch

From here, Branch will exchange SSH keys with WP Engine and set up a few environment variables for your project. These variables are used by the WP Engine build recipe in Branch.

By default, Branch will configure environment variables with the names of each of the environments you already have for your Site. You can see these variables under the Environment tab for your project:

Add Build Steps

Branch comes preconfigured with many different “build recipes”, which are combinations of build steps customized for various tools. Branch includes a WP Engine build recipe. To add a build step:

  1. Click your project name within the Branch dashboard
  2. Select Steps
  3. From here, you can start adding your build steps
  4. Scroll down to the section Add your first build step
  5. Click Add build step
  6. In the Build recipes menu, select the WP Engine build recipe
  7. Click Add step to add it to your build steps

Test and QA Steps

A huge advantage to using Branch is the ability to add steps specifically for functionality and quality. For example, tests can be added for PHP syntax or PHP version.

You can even add a Google Lighthouse QA step to be notified if your site scores too low on their page speed, SEO or accessibility tests after a deployment.

To learn more about testing with Lighthouse, see Branch’s guide on automated site monitoring.

To learn more about adding tests to your WordPress project, read Branch’s article about alternatives to PHPUnit for WordPress development.

Advanced Options

You might also want to run different steps only on certain Git branches. Branch makes configuring custom steps for specific Git branches simple. To do so, toggle the Advanced options tab of the build step and enter the name of the required branch.

For more information on configuring custom steps, see the full guide on Branch.

Trigger Your Build

There are two methods to trigger your build to push: Manually and automatically. For your first build we recommend triggering the build manually.

  1. Open your project’s Configuration page in Branch
  2. Click Run build

This will trigger a build from the default branch ‘master’, unless you changed this under Advanced options.

Once the build has run, the build steps will turn green and you will see any build logs. From your WordPress wp-admin dashboard back on WP Engine, you will be able to see that your plugin has been deployed.

After the first manual build, any commits pushed to your GitHub, Bitbucket or Gitlab will automatically trigger Branch. Branch will then run your build steps and deploy those changes to WP Engine using RSync.

NEXT STEP: Learn about best practices for deploying updates when using version control.

Still need help? Contact support!

We offer support 24 hours a day, 7 days a week, 365 days a year. Log in to your account to get expert one-on-one help.

The best in WordPress hosting.

See why more customers prefer WP Engine over the competition.