Circle CI x WPEngine – DEPRECATED
Note: As of April 2023, Kalamuna is moving to deprecate the use of CircleCI in favor of GitHub Actions.
This guide will remain in place in case we need to work with or troubleshoot legacy installs.
Guide to Enabling Circle CI with a WPEngine Project
Create and Connect the project on Circle CI: https://circleci.com/docs/2.0/getting-started/
Set up your config.yml task with the associated subtasks. This step will look different based on the distro of WP you are using. Here is an example with Building Changes which uses bedrock:
version: 2
composer config -g github-oauth.github.com a5c3af2e7715f035ec4715acd60e18650baa3bf7
jobs:
build-and-deploy-dev:
docker:
- image: circleci/php:7.1-node-browsers
working_directory: ~/repo
steps:
- checkout
- run: npm install
- run: composer install --prefer-dist --no-dev -o
- run: npm run build-all
- run: mkdir wp-content
- run: cp -R web/app/* wp-content
- run: rm wp-content/mu-plugins/bedrock-autoloader.php
- run: rm wp-content/mu-plugins/disallow-indexing.php
- run: rm wp-content/mu-plugins/register-theme-directory.php
- run: ssh-keyscan -H devbuildingc.ssh.wpengine.net >> ~/.ssh/known_hosts
- run: sudo apt install rsync
- run: rsync -avzr --exclude-from='./.circleci/rsync-exclude-file.txt' --no-perms --no-owner --no-group --delete ./wp-content devbuildingc@devbuildingc.ssh.wpengine.net:/sites/devbuildingc
workflows:
version: 2
build_and_deploy_dev:
jobs:
- build-and-deploy-dev:
filters:
branches:
only: development
Set up Circle CI to push to WPEngine via rsync after all tasks are complete.
WPEngine SSH login is displayed on the site overview
WPEngine needs the public key, and Circle CI will need your private key.
In WPE, under Account (top right) -> Profile -> SSH Keys add the public key
In Circle CI, under the Project Settings -> SSH Keys -> Additional SSH keys add the private key
Hot Tips
If you aren’t sure where your rsync is going, but it succeeds, try ssh’ing into the WPEngine instance. You can use that to figure out the project’s directory.
If you need to execute a command in a sub-directory, write it like so:
- run:
command: composer install
working_directory: wp-content/themes/understrap-master/