THIS REPO IS NO LONGER MAINTAINED -

For the latest stable and maintained version, plese refer to the official WP Engine repo here: https://github.com/marketplace/actions/deploy-wordpress-to-wp-engine

GitHub Action for WP Engine SSH Deployments

This GitHub Action can be used to deploy your WordPress repo/branch from Github to a WP Engine environment (Production / Stage / Dev) via the WP Engine SSH Gateway toolkit and a prefashioned rsync protocol. This can also be used to specifically deploy a single directory of your choice such as a theme or plugin directory.

Example GitHub Action workflow

  1. Create a .github/workflows/main.yml file in your root of your WordPress project/repo, if one doesn't exist already.

  2. Add the following to the main.yml file, replacing and the public and private key var names if they were anything other than what is below. Consult "Furthur Reading" on how to setup keys in repo Secrets.

  3. Git push your site repo.

name: Deploy to WP Engine

on:  
  push:
    branches:
        - master

jobs:
  build:

    runs-on: ubuntu-latest
        
    steps: 
    - uses: actions/checkout@v2
    - name: SSH Deploy to WP Engine
      uses: bowiedev/github-action-wpengine-ssh-deploy@master 
      env: 
          WPE_ENV_NAME: yoursitename 
          WPE_SSHG_KEY_PUBLIC: ${{ secrets.PUBLIC_KEY_NAME }} 
          WPE_SSHG_KEY_PRIVATE: ${{ secrets.PRIVATE_KEY_NAME }} 
          TPO_SRC_PATH: ""
          TPO_PATH: ""

          

Environment Variables & Secrets

Required

Name Type Usage
WPE_ENV_NAME Environment Variable Insert the name of the WP Engine environment you want to deploy to.
WPE_SSHG_KEY_PRIVATE Secret Private SSH Key for the SSH Gateway and deployment. See below for SSH key usage.
WPE_SSHG_KEY_PUBLIC Secret Public SSH Key for the SSH Gateway and deployment. See below for SSH key usage.

Optional

Name Type Usage
TPO_SRC_PATH Optional path to specify a theme, plugin, or other directory source to deploy from. Ex. "wp-content/themes/genesis-child/" . Defaults to "." Dir.
TPO_PATH Optional path to specify a theme, plugin, or other directory you want to deploy to. Ex. "wp-content/themes/genesis-child/" . Note the ending slash.

Note: If you do not use the TPO_PATH , simply leave "" as is.

Further reading

Setting up your SSH keys for repo

  1. Generate a new SSH key pair as a special deploy key between your Github Repo and WP Engine. The simplest method is to generate a key pair with a blank passphrase, which creates an unencrypted private key.

  2. Store your public and private keys in the GitHub repository of your website as new 'Secrets' (under your repository settings) using the names PRIVATE_KEY_NAME and PUBLIC_KEY_NAME respectively with the name in your specfic files. These can be customized, just remember to change the var in the yml file to call them correctly.

  3. Add the Public SSH key to your WP Engine SSH Gateway configuration. https://wpengine.com/support/ssh-gateway/#addsshkey