Automate WordPress core, plugin and theme updates on Pantheon) with Terminus, CircleCI, WP-CLI, BackstopJS and Slack.
This script will:
- Authenticate with Terminus via machine token
- Delete the multidev environment
update-wp
- Recreate the multidev environment
update-wp
- Deletion and recreation is done to clear any existing changes and pull the latest database/files from the live environment
- Switch the multidev environment
update-wp
to Git mode - Apply Pantheon upstream updates
- WordPress core updates are managed in the upstream
- Switch the multidev environment
update-wp
to SFTP mode - Check for and apply WordPress plugin updates via WP-CLI, if available
- Check for and apply WordPress theme updates via WP-CLI, if available
- If no WordPress updates are available the script will complete and report the Slack
- Use BackstopJS to run a visual regression test between the live environment and the multidev environment
- If discrepencies are found the script will fail and report the error to Slack
- Merge the multidev environment with the dev environment
- Deploy the dev environment to the test environment
- Deploy the test environment to the live environment
- Post a success message to Slack
- Create a CircleCI project
- Add environment variables to CircleCI for the following:
SITE_UUID
: The Pantheon site UUIDTERMINUS_MACHINE_TOKEN
: A Pantheon Terminus machine token with access to the siteSLACK_HOOK_URL
: The Slack incoming webhook URLSLACK_CHANNEL
: The Slack channel to post notifications toSLACK_USERNAME
: The username to post to Slack with
- Add an SSH key to Pantheon and to the CircleCI project.
- Update the site UUID in the
.env
file - Update scenarios in
backstop.js
with URLs for pages you wish to check with visual regressionurl
refers to the live URL andreferenceUrl
refers to the same page on the Pantheon multidev environment
- Ping the CircleCI API at the desired frequency, e.g. daily, to run the script
This workflow assumes the master
branch (dev) and test environments on Pantheon are always in a shippable state as the script will automatically deploy changes from dev to test and live.
All incomplete work should be kept in a Pantheon multidev environment, on a separate Git branch.