Last active
August 29, 2015 14:16
-
-
Save heyfletch/eeef8908ee0d634fed67 to your computer and use it in GitHub Desktop.
Push to WP Engine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Push to WP Engine | |
function gppm() { | |
# check if we are in a git repository | |
if git rev-parse --git-dir > /dev/null 2>&1; then | |
# check if there any untracked files that need to be commited. | |
git ls-files --exclude-standard --others --error-unmatch . >/dev/null 2>&1; ec=$? | |
if test "$ec" = 0; then | |
echo | |
echo "WARNING: There are untracked files in the repo. Exiting the production deployment process now." | |
echo | |
git status | |
echo | |
return | |
fi | |
else | |
echo "This is not a git repository. Ending the deploy process." | |
echo | |
return | |
fi | |
echo | |
echo "Pushing Code Changes to WP Engine now." | |
echo "May need to do gulp --production first. Consider adding to the gppm function." | |
git push production master | |
echo | |
echo "Pushing Code Changes to GitHub repo now." | |
git push | |
echo | |
echo | |
echo "Pushing full database to WP Engine now." | |
wp migratedb profile 1 | |
# More info here: https://deliciousbrains.com/wp-migrate-db-pro/doc/cli-profile-subcommand/ | |
# To do: implement new CLI options: https://deliciousbrains.com/wp-migrate-db-pro/doc/cli-push-pull-subcommand/ | |
echo | |
echo | |
} |
Note: because WP Engine's git repo does not allow a pull (it only allows for pushing code to it), I also push to my Github repo which I use as my main repo to push/pull to/from staging, prod, local.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To Do: Add options for production vs. staging
To Do: Add options for --db-only, code-only
To Do: Implement new CLI options: https://deliciousbrains.com/wp-migrate-db-pro/doc/cli-push-pull-subcommand/
To Do: May add back in option to do "gulp --production" before pushing to production... need to test with Sage 8.0.0 and WP Engine