Skip to content
box

GitHub Action

Deploy to WPEngine

v1.0.0 Latest version

Deploy to WPEngine

box

Deploy to WPEngine

An action to deploy a WordPress project to a WP Engine site via git

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Deploy to WPEngine

uses: somoscuatro/[email protected]

Learn more about this action in somoscuatro/action-deploy-to-wpengine

Choose a version

GitHub Action for WP Engine Git Deployments

Welcome to the official repository of the GitHub Action for WP Engine Git Deployments. This action allows you to automatically deploy your WordPress project to a WP Engine site via Git.

Usage

  1. Generate an SSH key for authentication between GitHub and WP Engine

  2. Add the public SSH key to your WP Engine website environment: Sites > Your Website Environment > GitPush. See Git Version Control System WP Engine documentation page

  3. In your GitHub Repository settings, create new Secrets for the SSH Private (WPENGINE_SSH_PRIVATE_KEY) and Public keys (WPENGINE_SSH_PUBLIC_KEY). See Adding secrets for a repository documentation

  4. Create a workflow file in your project repo, for example .github/workflows/deploy.yml

  5. Add the following code to the workflow file you just created:

    name: Deploy to WP Engine
    
    on:
      # In this example we are deploying to WP Engine when a new release is published.
      # You can change this to be on PR merge, push to a given branch, etc.
      # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
      release:
        types: [published]
    
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v3
            name: Checkout repository
            with:
              fetch-depth: 0
    
          # Do your things here.
          # For example install dependencies, build assets before deploying, etc.
    
          - name: Deploy
            uses: somoscuatro/action-deploy-to-wpengine
            env:
              WPENGINE_SSH_PRIVATE_KEY: ${{ secrets.WPENGINE_SSH_PRIVATE_KEY }}
              WPENGINE_SSH_PUBLIC_KEY: ${{ secrets.WPENGINE_SSH_PUBLIC_KEY }}
              WPENGINE_ENVIRONMENT_NAME: production # Defaults to production. Adjust to match your WP Engine environment name, if needed.
  6. If you want to exclude some files to be deployed, create a .github/workflows/deploy/excluded file in your project repo containing untracked files and folders that WP Engine should ignore. For example:

    .vscode
    .docker
    docker-compose.yml
    .env

Environment Variables & Secrets

Required

Name Type Required Usage
WPENGINE_SSH_PRIVATE_KEY Secret Yes Private SSH key of your WP Engine git deploy user. See below for SSH key usage.
WPENGINE_SSH_PUBLIC_KEY Secret Yes Public SSH key of your WP Engine git deploy user. See below for SSH key usage.
WPENGINE_ENVIRONMENT_NAME Environment Variable No Defaults to production.

How to Contribute

Any kind of contribution is very welcome!

Please, be sure to read our Code of Conduct.

If you notice something wrong please open an issue or create a Pull Request or just send an email to [email protected]. If you want to warn us about an important security vulnerability, please read our Security Policy.

License

All code is released under MIT license version. For more information, please refer to LICENSE.md file.