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
.
- Introduction
- Project Structure
- Requirements
- Setup
- Configuration
- Usage
- GPG Workflow (Optional)
- Optional Bash Aliases
- Contributing
- License
- Changelog
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
.
.
├── 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
- Bash (or Zsh)
- Git
- Composer
- GPG (optional)
- WP Engine Git access
-
Clone this repo:
git clone git@github.com:PloverHub/wpengine-gitpush-deploy.git cd yourrepo
-
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. -
Make sure scripts are executable:
chmod +x deploy/*.sh
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.
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.
If your .env
files are GPG-encrypted, you can enable decryption:
export RUN_GPG_DECRYPT="true"
wp-content/app/config/env_dev.gpg
wp-content/app/config/env_stag.gpg
wp-content/app/config/env_prod.gpg
~/.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.
alias wpe.prod="make prod deploy"
alias wpe.stag="make stag deploy"
alias wpe.dev="make dev deploy"
Reload shell:
source ~/.zshrc # or ~/.bashrc
- Fork the repo
- Create a branch:
feature/my-change
- Use Conventional Commits
- Submit a pull request
See LICENSE
See CHANGELOG.md