Skip to content

PloverHub/wpengine-gitpush-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP Engine Deployment Scripts

A structured Bash + Makefile toolkit for automating WordPress deployments to WP Engine environments. It includes environment bootstrapping, repository preparation (Composer, cleanup), and Git pushing to environment-specific remotes. Configuration is centralized in config/env.sh.


Table of Contents

  1. Introduction
  2. Project Structure
  3. Requirements
  4. Setup
  5. Configuration
  6. Usage
  7. GPG Workflow (Optional)
  8. Optional Bash Aliases
  9. Contributing
  10. License
  11. Changelog

Introduction

This repository provides a robust and reusable set of scripts to manage WordPress deployments to WP Engine. Instead of manually coordinating Git commands and Composer actions, use structured Make targets and Bash tasks to deploy to dev, stag, or prod.


Project Structure

.
├── Makefile                  # Task-based CLI entry point
├── config/
│   ├── env.sh                # Project-specific settings
│   └── example.env.sh        # Template for new projects
├── deploy/
│   ├── deploy.sh             # Main script: init, prep, push, deploy
│   ├── header.sh             # Strict-mode, path detection, config loader
│   └── file_templates/
│       └── gitignore_wpe     # Gitignore template for WP Engine
├── README.md
├── LICENSE
└── CHANGELOG.md

Requirements

  • Bash (or Zsh)
  • Git
  • Composer
  • GPG (optional)
  • WP Engine Git access

Setup

  1. Clone this repo:

    git clone git@github.com:PloverHub/wpengine-gitpush-deploy.git
    cd yourrepo
  2. Copy and configure your environment:

    cp config/example.env.sh config/env.sh

    Edit config/env.sh with your actual repo and WP Engine remotes.

  3. Make sure scripts are executable:

    chmod +x deploy/*.sh

Configuration

Edit config/env.sh and fill in your project-specific values:

export BLOG_GIT_REPO="git@github.com:YOURORG/YOURPROJECT.git"
export WPE_GIT_DEV="git@git.wpengine.com:production/dev-repo.git"
export WPE_SSH_DEV="ssh user@dev.ssh.wpengine.net"
...
export RUN_GPG_DECRYPT="true"

Also define the list of files to delete before deploying.


Usage

Run all deployment tasks via Make:

make dev init        # Clone repo and (optionally) decrypt .env
make dev prep        # Composer install + file cleanup
make dev push        # Git remote setup + push

## OR just:

make dev deploy      # Full init + prep + push

Replace dev with stag or prod as needed.


GPG Workflow (Optional)

If your .env files are GPG-encrypted, you can enable decryption:

1. Enable it in env.sh:

export RUN_GPG_DECRYPT="true"

2. Place encrypted envs:

wp-content/app/config/env_dev.gpg
wp-content/app/config/env_stag.gpg
wp-content/app/config/env_prod.gpg

3. Provide your GPG passphrase file:

~/.paraphrase_gpg

The script will automatically:

  • Detect the environment (dev/stag/prod)
  • Decrypt env_<ENV>.gpg
  • Output it to the configured WP_ENV_PATH

Make sure GPG is installed and configured properly with your keypair.


Optional Bash Aliases

alias wpe.prod="make prod deploy"
alias wpe.stag="make stag deploy"
alias wpe.dev="make dev deploy"

Reload shell:

source ~/.zshrc  # or ~/.bashrc

Contributing

  1. Fork the repo
  2. Create a branch: feature/my-change
  3. Use Conventional Commits
  4. Submit a pull request

License

See LICENSE


Changelog

See CHANGELOG.md

About

Bash scripting to automate deployment onto WP Engine

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published