Skip to content

indigotree/github-action-deploy-to-wpe

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Action to deploy WordPress projects to WP Engine

Indigo Tree fork of the WP Engine deploy action. Deploy from a GitHub repo to a WP Engine environment via SSH Gateway and rsync.

One workflow step can run multiple rsync jobs over a single SSH connection by passing a DEPLOYS JSON array.

Pin uses: to a commit SHA or branch.

Setup Instructions

  1. Workflow
  • Add a deploy workflow under .github/workflows/ (see Example).
  • Set DEPLOYS to a JSON array of jobs (see DEPLOYS schema).
  • Configure branch and environment inputs (PRD_BRANCH, PRD_ENV, etc.).
  1. SSH private key (GitHub)
  1. SSH public key (WP Engine)
  • Add the public key to SSH Gateway. This action does not use GitPush keys.
  1. Push to a configured branch. View logs under Actions.

Branch names must match the pushed ref exactly (refs/heads/<name>). Use on.push.branches to match PRD_BRANCH, STG_BRANCH, and DEV_BRANCH.

DEPLOYS schema

DEPLOYS is a JSON array inline in the workflow step (DEPLOYS: |).

Each object:

Field Required Description
src Yes Source path in the checkout (globs allowed, e.g. wp-content/plugins/foo-*)
flags Yes Rsync flags for this job (e.g. -azvr --inplace --exclude-from=.deployignore)
dest No Destination directory on the server (default "" = site root relative)
name No Label for logs only

Jobs run in array order on one SSH session.

Example platform deploy step

Replace multiple uses: deploy steps with one step like this (pin @<commit-sha> after merging this action):

      - name: Deploy to WP Engine
        uses: indigotree/github-action-deploy-to-wpe@<pin>
        with:
          WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
          CACHE_CLEAR: FALSE
          PHP_LINT: FALSE
          DEV_BRANCH: ${{ env.DEV_BRANCH }}
          STG_BRANCH: ${{ env.STG_BRANCH }}
          PRD_BRANCH: ${{ env.PRD_BRANCH }}
          DEV_ENV: ${{ env.DEV_ENV }}
          STG_ENV: ${{ env.STG_ENV }}
          PRD_ENV: ${{ env.PRD_ENV }}
          DEPLOYS: |
            [
              {
                "name": "plugins-once",
                "src": "wp-content/plugins",
                "dest": "wp-content",
                "flags": "-azvr --inplace --ignore-existing --exclude-from=.deployignore"
              },
              {
                "name": "project-plugins",
                "src": "wp-content/plugins/indigotree-site-*",
                "dest": "wp-content/plugins",
                "flags": "-azvr --inplace --exclude-from=.deployignore"
              },
              {
                "name": "modules",
                "src": "wp-content/platform",
                "dest": "wp-content",
                "flags": "-azvr --inplace --delete --delete-delay --exclude-from=.deployignore"
              },
              {
                "name": "mu-plugins",
                "src": "wp-content/mu-plugins",
                "dest": "wp-content",
                "flags": "-azvr --inplace --exclude-from=.deployignore"
              },
              {
                "name": "theme-and-rest",
                "src": ".",
                "dest": "",
                "flags": "-azvr --inplace --exclude-from=.deployignore --exclude=/*.* --exclude=_wpeprivate/ --exclude=wp-admin/ --exclude=wp-includes/ --exclude=wp-content/plugins/ --exclude=wp-content/platform/ --exclude=wp-content/mu-plugins/ --exclude=wp-content/uploads/ --exclude=wp-content/upgrade*/ --exclude=wp-content/drop-ins/ --exclude=wp-content/languages/ --exclude=mysql.sql --include=/wp-content/themes/ --include=/wp-content/themes/indigotree-theme-2026/*** --exclude=/wp-content/themes/*"
              }
            ]

Minimal single-job example:

      - uses: actions/checkout@v4
      - name: Deploy to WP Engine
        uses: indigotree/github-action-deploy-to-wpe@<pin>
        with:
          WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
          PRD_BRANCH: main
          PRD_ENV: myinstall
          DEPLOYS: |
            [
              {
                "src": ".",
                "dest": "",
                "flags": "-azvr --inplace --exclude-from=.deployignore"
              }
            ]

Migration from older action inputs

If you previously used several deploy steps with TPO_SRC_PATH, TPO_PATH, and FLAGS:

Old input DEPLOYS field
TPO_SRC_PATH src
TPO_PATH dest
FLAGS flags
  1. Merge each old step into one object in the DEPLOYS array (preserve order).
  2. Use a single uses: step with DEPLOYS: |.
  3. Set CACHE_CLEAR: FALSE unless you want a post-deploy flush (default is false).
  4. Pin uses: to the commit SHA that includes DEPLOYS support.

WPE_SSHG_KEY_PRIVATE format is unchanged from v0.4.0 (raw PEM in GitHub Secrets).

Removed inputs: TPO_SRC_PATH, TPO_PATH, FLAGS, SCRIPT.

Inputs

Required

Name Type Usage
DEPLOYS string JSON array of deploy jobs (inline in workflow YAML).
PRD_BRANCH string Production branch name (exact match to refs/heads/<name>).
PRD_ENV string WP Engine production environment name.
WPE_SSHG_KEY_PRIVATE secrets Private SSH key (raw PEM).

Optional

Name Type Usage
STG_BRANCH string Staging branch (exact match). Leave placeholder if unused.
STG_ENV string WP Engine staging environment.
DEV_BRANCH string Development branch (exact match).
DEV_ENV string WP Engine development environment.
PHP_LINT bool TRUE to run php -l on each job src before deploy. Default false.
CACHE_CLEAR bool TRUE to flush page and CDN cache after all jobs. Default false.

Further reading

Legal

See LICENSE.

Copyright (C) 2021-present, Indigo Tree Digital Ltd.

Based on prior work from https://github.com/wpengine/github-action-wpe-site-deploy
Copyright (c) 2021 WP Engine

About

WordPress-specific deployment checks (a Github action).

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors