Skip to content

Instantly share code, notes, and snippets.

@yan-kisen
Last active October 13, 2025 20:27
Show Gist options
  • Select an option

  • Save yan-kisen/39753efffa8b1cb2d3f29bb718730380 to your computer and use it in GitHub Desktop.

Select an option

Save yan-kisen/39753efffa8b1cb2d3f29bb718730380 to your computer and use it in GitHub Desktop.
`wp-engine` GitHub Action Setup
# FILE_PATH: `/.deployignore`
## NOTE: files to be ignored should be absolute FROM the `SRC_PATH` `<project_root>/wp-content/themes/ignore-me.txt`
/ignore-me.txt
# FILE_PATH: `/.github/workflows/wpengine-stage.yml`
name: Deploy to WP Engine
on:
push:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: GitHub Action Deploy to WP Engine
uses: wpengine/github-action-wpe-site-deploy@v3
# Ref: https://github.com/wpengine/github-action-wpe-site-deploy
with:
# Deploy vars
WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
WPE_ENV: ${{vars.WPE_ENV_STAGE}}
# Deploy Options
SRC_PATH: "wp-content/themes/<theme_dir>/"
REMOTE_PATH: "wp-content/themes/<theme_dir>/"
PHP_LINT: FALSE
## RSYNC Flags
FLAGS: -azvr --inplace --delete --exclude=.* --exclude-from=.deployignore
#### NOTE: `.deployignore` should be in the repository root & all files therein should be absolute starting at the `SRC_PATH` (with leading slash)
## Remote bash file to execute post-deploy. This can include WP_CLI commands for example. Path is relative to the WP root and file executes on remote. This file can be included in your repo, or be a persistent file that lives on your server.
# SCRIPT: "path/yourscript.sh"
CACHE_CLEAR: TRUE
@yan-kisen
Copy link
Author

References:

Configuration Steps.

  1. Create & configure the WPE_SSHG_KEY_PRIVATE Repository Secret
    a. https://wpengine.com/support/ssh-keys-for-shell-access/#Generate_New_SSH_Key
  2. Create .github/workflows/wpengine-stage.yml & .github/workflows/wpengine-prod.yml
    a. Update branches accordingly
  3. Define repository variables WPE_ENV_STAGE & WPE_ENV_MAIN to correspond to WP Engine environment names
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment