• Stars
    star
    151
  • Rank 237,235 (Top 5 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 3 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A GitHub Action to deploy code directly to WP Engine.

WP Engine GitHub Actions Site Deployment

Test e2e Deploy to WP Engine Lint GHA Files Version and Release

WP Engine GitHub Action for Site Deployment

Use this GitHub Action to deploy code from a GitHub repo to a WP Engine environment of your choosing. If you do not have a WP Engine Account, click here to get started! If you do have an account, check out our guided step-by-step instructions.

This action enables you to:

  • Deploy a full site directory or subdirectory of your WordPress install
  • Perform a PHP Lint
  • Customize rsync flags
  • Clear cache
  • Execute a post-deploy script of your choosing

Setup Instructions

  1. SSH PUBLIC KEY SETUP IN WP ENGINE
  1. SSH PRIVATE KEY SETUP IN GITHUB
  1. YML SETUP
  • Create .github/workflows/main.yml directory and file locally. Copy and paste the configuration from below, replacing the value under branches: and the value for WPE_ENV:.

  • To deploy from another branch, simply create another yml file locally for that branch, such as .github/workflows/stage.yml and replace the values for branches: and WPE_ENV: for that workflow.

This provides the ability to perform a different workflow for different branches/environments. Consult "Environment Variable & Secrets" for more available options.

  1. Git push your site GitHub repo. The action will do the rest!

View your actions progress and logs by navigating to the "Actions" tab in your repo.

Example GitHub Action workflow

Simple main.yml:

name: Deploy to WP Engine
on:
  push:
    branches:
     - main
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
      with:
        WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
        WPE_ENV: <your_install_name_here>

Extended main.yml

name: Deploy to WP Engine
on:
  push:
    branches:
     - main
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
      with:
      # Deploy vars
        WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
        WPE_ENV: <your_install_name_here>
        # Deploy Options
        SRC_PATH: "wp-content/themes/genesis-child-theme/"
        REMOTE_PATH: "wp-content/themes/genesis-child-theme/"
        PHP_LINT: TRUE
        FLAGS: -azvr --inplace --delete --exclude=".*"  --exclude=wp-content/mu-plugins/local-plugin --exclude-from=ignorefile.txt
        SCRIPT: "path/yourscript.sh"
        CACHE_CLEAR: TRUE

Environment Variables & Secrets

Required

Name Type Usage
WPE_SSHG_KEY_PRIVATE secrets Private SSH Key for the SSH Gateway and deployment. See below for SSH key usage.

Deploy Options

Name Type Usage
WPE_ENV string Insert the name of the WP Engine environment you want to deploy to. This also has an alias of PRD_ENV, STG_ENV, or DEV_ENV for multi-step workflows.
SRC_PATH string Optional path to specify a directory within the repo to deploy from. Ex. "wp-content/themes/genesis-child-theme/". Defaults to root of repo filesystem as source.
REMOTE_PATH string Optional path to specify a directory destination to deploy to. Ex. "wp-content/themes/genesis-child-theme/" . Defaults to WordPress root directory on WP Engine.
PHP_LINT bool Set to TRUE to execute a php lint on your branch pre-deployment. Default is FALSE.
FLAGS string Set optional rsync flags such as --delete or --exclude-from. The example is excluding paths specified in a .deployignore file in the root of the repo. This action defaults to a non-destructive deploy using the flags in the example above.

Caution: Setting custom rsync flags replaces the default flags provided by this action. Consider also adding the -azvr flags as needed.
-a preserves symbolic links, timestamps, user permissions and ownership.
-z is for compression
-v is for verbose output
-r is for recursive directory scanning
SCRIPT string 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.
CACHE_CLEAR bool Optionally clear page and CDN cache post deploy. This takes a few seconds. Default is TRUE.

Further reading

Versioning

We follow SemVer and GitHub's action versioning recommendations for maintaining major, minor, and patch version tags. Patch tags (e.g. v1.1.1) are created for each release and will not move once created. Major tags (e.g. v1) and minor tags (e.g. v1.1) will be updated to track their respective latest versions.

We recommend binding this action to the latest major tag so that you will receive backwards compatible updates.

More Repositories

1

faustjs

Faust.js™ - The Headless WordPress Framework
TypeScript
1,308
star
2

frost

The ultimate WordPress block theme for website designers and developers.
PHP
509
star
3

atlas-content-modeler

Content modeling plugin for WordPress
PHP
166
star
4

phpcompat

WordPress Plugin: PHP Compatibility Checker
PHP
115
star
5

wp-graphql-content-blocks

Plugin that extends WPGraphQL to support querying (Gutenberg) Blocks as data
PHP
82
star
6

geoip

WordPress Plugin: WP Engine GeoTarget
PHP
46
star
7

php-docker

RD - PHP docker base images
Roff
45
star
8

headless-docs

***Deprecated ***WP Engine Headless Documentation for Developers
MDX
37
star
9

wpe-search-DEPRECATED

A WordPress plugin for integrating ElasticSearch with WP Engine, based off of ElasticPress
PHP
32
star
10

wpengine-coding-standards

WP Engine Coding Standards for WordPress
Shell
28
star
11

atlas-blueprint-portfolio

A portfolio template for Atlas Blueprints
JavaScript
26
star
12

block-pattern-explorer

An experimental plugin to preview and insert block patterns in WordPress.
JavaScript
19
star
13

base-images-public

Simple Docker Images
Dockerfile
15
star
14

faust-scaffold

Lightweight scaffolding for your next headless WordPress app!
JavaScript
14
star
15

wp-graphql-filter-query

Adds taxonomy filtering and aggregation support to WP GraphQL
PHP
10
star
16

example-sage-theme

Modern theme development with WP Engine
PHP
8
star
17

atlas-blueprint-basic

A basic template for Atlas Blueprints
JavaScript
7
star
18

faust-scaffold-ts

Faust Scaffold Blueprint in TypeScript
TypeScript
7
star
19

newrelic-docker-DEPRECATED

New Relic Daemon Docker Image
6
star
20

atlas-commerce-blueprint

An eCommerce template for Atlas Blueprints
JavaScript
6
star
21

homebrew-wpe-cli

A Homebrew formula for wpe-cli
Ruby
6
star
22

hackathon-catation

Hackathon 2020 project: IPFS photo sharing
Go
4
star
23

atlas-shopify-blueprint

Atlas Shopify Blueprint
JavaScript
4
star
24

site-deploy

Base image to build VCS integrations enabling customers to deploy their site to WP Engine
Shell
3
star
25

faust-atlas-hello-world

"Hello World" example project using Faust.js for Atlas
TypeScript
3
star
26

wpe-graphql-cache

An integration with wp-graphql and WPE to purge graphql requests cached in Varnish.
PHP
2
star
27

atlas-blueprint-blog

A blog template for Atlas Blueprints
JavaScript
2
star
28

acm-content-connect

Fork of the 10up WordPress library that enables direct relationships for posts to posts.
PHP
1
star