Coder Social home page Coder Social logo

github-action-wpe-site-deploy's Introduction

GitHub Action for WP Engine Site 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. Deploy a theme, plugin or other directory with the TPO options. Post deploy, this action will automatically purge your WP Engine cache to ensure all changes are visible.

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:
        - main

jobs:
  build:

    runs-on: ubuntu-latest
        
    steps: 
    - uses: actions/checkout@v2
    - name: GitHub Deploy to WP Engine
      uses: wpengine/github-action-wpe-site-deploy@main
      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 destination to deploy to. Ex. "wp-content/themes/genesis-child/" . Defaults to WordPress root directory.

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

github-action-wpe-site-deploy's People

Contributors

bowiedev avatar wpe-jenkins-github-admin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.