My workflow for using Sage 9 + WPEngine Git Push
I maintain a couple WP installs that live on WPE. There are a lot of good points in how WPE configures their servers, but the WPE git push setup is a lil limited. I thought it might be helpful for me to share how I’ve worked around the WPE Git setup, and I’d love to hear from other folks maintaining Sage sites on WPE.
The primary issue with WPE and modern build tools is that WPE does not support asset building, so it expects your local repo to contain compiled assets. In order to push a production version of a Sage theme, the /dist directory needs to be under version control… and those aren’t really the files I want to keep in my origin repo.
I settled on using Codeship’s CI platform to clone my repo, then execute build and deploy scripts. Yes, there are probably plenty of other ways to hook a deploy script in, but this was the simplest for an amateur Git user like me. Codeship is free up to 100 builds/mo, which is plenty for these sites. And, they provide shell access, which is very helpful for experimenting.
#My current setup looks like this:
My .gitignore includes:
dist node_modules npm-debug.log yarn-error.log yarn.lock vendor
I use the local repo to branch, build new features, etc., then push to
##Origin Repo on github
After pushing to github, the repo is cloned into
Codeship offers virtual machines to clone a repo and then execute build / deploy scripts. I have two Codeship pipelines set up—one for staging and one for production.
With each deploy to codeship, on the remote machine, I build a production version of my theme, destroy the local .gitignore, and swap it for a new file that ignores directories / files that may or may not exist in repo AND should not be on the server, like:
resources/assets .editorconfig .eslintrc .gitattributes .gitignore .travis.yml composer.json composer.lock package.json yarn-error.log yarn.lock
My Codeship scripts also create a wp-content/themes/theme-name dir structure, so the final push to WPE will drop the theme in the right place. This approach keeps a clean local repo associated with the theme root. I should mention you will need to manually FTP the vendor directory into WPE before any of this will work.
I borrowed very heavily from this helpful guide published Zachary Watkins—he provides some great detailed step by step instructions and some starter scripts to use in Codeship.
Here’s the exact scripts I used for my particular build.
Now if I could just get a good workflow for compiling .blade templates locally…