6.5 Deployments
Production stability requires careful control over what code reaches live environments. Our deployment strategy centers on protecting the primary branch through automated checks and manual review, followed by seamless automated deployment using GitHub Actions when changes are approved and merged.
Our projects typically have three main branches, each associated with a projects server installation: develop, staging, and primary. The primary branch connects directly to the production environment and includes strict protection to prevent unstable code from reaching live sites. Branch protection rules enforce our quality standards automatically through GitHub’s interface, ensuring that no code reaches production without proper validation, successful test completion, and an approving manual code review. Once these have been met, a merge request can complete, bringing the new code into the primary branch and triggering an automated deployment.
GitHub Actions orchestrate the majority of our deployment process, triggered automatically when pull requests merge into one of the main branches. The Action runs the same build and testing scripts used in local development, adding another quality check layer to a project. Once testing is complete and assets built, the Action uses rsync to efficiently move new code into place, using a standard exclusions list to prevent unnecessary code or files from being moved to the server.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Deploy to Development
on:
push:
branches: [ develop ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# PHP Testing
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, xml, ctype, iconv, intl, pdo_mysql
- name: Install Dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Run Tests
run: vendor/bin/phpunit
- name: Run Code Standards Check
run: vendor/bin/phpcs
# Asset Building
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install Node Dependencies & Build Assets
run: yarn install --immutable && yarn dev
- name: Deploy to WP Engine
uses: wpengine/github-action-wpe-site-deploy@v3
with:
WPE_SSHG_KEY_PRIVATE: $
WPE_ENV: $
SRC_PATH: "wp/"
REMOTE_PATH: "/"
PHP_LINT: TRUE
FLAGS: -azvr --inplace -f merge_.gitignores/rsync-filters --delete-after
CACHE_CLEAR: TRUE