Skip to content

Instantly share code, notes, and snippets.

@ryanshoover
Last active January 16, 2020 21:44
Show Gist options
  • Save ryanshoover/58842d5605ba347dccd07f94916f77d3 to your computer and use it in GitHub Desktop.
Save ryanshoover/58842d5605ba347dccd07f94916f77d3 to your computer and use it in GitHub Desktop.
CircleCI deploy script to WP Engine
# Ignore everything in the root except the "wp-content" directory.
/*
!.git*
!wp-content/
!circle.yml
!composer.json
!auth.json
!package.json
!Gruntfile.js
!README.md
# Ignore everything in the "wp-content" directory, except the "plugins" and "themes"
wp-content/*
!wp-content/plugins/
!wp-content/themes/
# Ignore all plugins except ones we define
wp-content/plugins/*
!wp-content/plugins/my-custom-plugin
# Ignore all themes execpt ones we define
wp-content/themes/*
!wp-content/themes/my-custom-theme
# Ignore all compiled files
wp-content/themes/my-custom-theme/images
wp-content/themes/my-custom-theme/js
wp-content/themes/my-custom-theme/css
# Apple Index file
.DS_Store
# Various app files
*.sublime-*
*.codekit
# This is a problematic folder because of internal commits
wp-content/plugins/S3-Upload*
# Allow Google Authentication files in the repo (needed for deployment to HHVM)
!goog*.html
# known large file types
*.hqx
*.exe
*.dll
*.deb
*.dmg
*.iso
*.img
*.msi
*.msp
*.msm
*.mid
*.midi
*.kar
*.mp3
*.ogg
*.m4a
*.ra
*.3gpp
*.3gp
*.mp4
*.mpeg
*.mpg
*.mov
*.webm
*.flv
*.m4v
*.mng
*.asx
*.asf
*.wmv
*.avi
*.zip
*.tar
*.tgz
*.gz
# Ignore everything in the root except the "wp-content" & "phantomcss" directory.
/*
!.git*
!wp-content/
# Ignore specific files for deployment
phantomcss
node_modules
# Ignore everything in the "wp-content" directory, except the "plugins"
# and "themes" directories.
wp-content/*
!wp-content/plugins/
!wp-content/themes/
wp-content/plugins/S3-Uploads*
wp-content/plugins/bwp-minify/cache
wp-content/plugins/bwp-minify/min/config.php
wp-content/plugins/debug-*
wp-content/plugins/bwp-minify/cache
wp-content/plugins/log-deprecated-notices
wp-content/plugins/query-monitor
wp-content/plugins/rewrite-rules-inspector
wp-content/plugins/user-switching
# Ignore all themes execpt ones we define
wp-content/themes/*
!wp-content/themes/my-custom-theme/
# Mac-specific
.DS_Store
# Dev files
*.codekit
.svn
.sass-cache
# known large file types
*.hqx
*.bin
*.exe
*.dll
*.deb
*.dmg
*.iso
*.img
*.msi
*.msp
*.msm
*.mid
*.midi
*.kar
*.mng
*.asx
*.asf
*.wmv
*.zip
*.tar
*.tgz
*.gz
*.mp4
###################
## CUSTOM VARIABLES
## WPE_INSTALL = the install name you're deploying to
####################
## Set PHP version to match production server
machine:
php:
version: 7.0.11
dependencies:
pre:
# Grunt v 1.0.1 only passes installation if it's installed globally
- npm install -g grunt
## Deployement
deployment:
###Staging
staging:
branch: staging
commands:
- git ls-remote [email protected]:staging/${WPE_INSTALL}.git
- git config --global user.email "[email protected]"
- git config --global user.name "CircleCI Deploy Script"
- git remote add wpe [email protected]:staging/${WPE_INSTALL}.git
- git fetch wpe --unshallow
- git status
- git checkout -b staging-$CIRCLE_BUILD_NUM
- unlink .gitignore
- ln -s .gitignores/__deployment .gitignore
- grunt build
- git add .
- git commit -m "deployment commit"
- git push wpe staging-$CIRCLE_BUILD_NUM
- git push wpe :staging-$CIRCLE_BUILD_NUM
# - grunt qa --target=http://${WPE_INSTALL}.staging.wpengine.com
###Production
production:
branch: master
commands:
- git ls-remote [email protected]:production/${WPE_INSTALL}.git
- git config --global user.email "[email protected]"
- git config --global user.name "CircleCI Deploy Script"
- git remote add wpe [email protected]:production/${WPE_INSTALL}.git
- git fetch wpe --unshallow
- git status
- git checkout -b master-$CIRCLE_BUILD_NUM
- unlink .gitignore
- ln -s .gitignores/__deployment .gitignore
- grunt build
- git add .
- git commit -m "deployment commit"
- git push wpe master-$CIRCLE_BUILD_NUM
- git push wpe :master-$CIRCLE_BUILD_NUM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment