Skip to content

Instantly share code, notes, and snippets.

@spicecadet
Last active October 5, 2020 21:40
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spicecadet/7cb700a55878ae986df673167e692ed4 to your computer and use it in GitHub Desktop.
Save spicecadet/7cb700a55878ae986df673167e692ed4 to your computer and use it in GitHub Desktop.
This is my deployment script for pushing from Github to a WP Engine WordPress install. The scripts below can be added as custom scripts to Codeship's Deployment Pipelines.
# Environment Variables
#INSTALL=
#EMAIL=
#ENVIRONMENT="production"
#SERVICE=
#ASSERTIBLE_CODE=
# Use PHP 7.2 and stable version of node
phpenv local 7.2
nvm use stable
# Set production remote and config
git config --global user.name "Codeship Deploy"
git config --global user.email "$EMAIL"
git remote add $ENVIRONMENT git@git.wpengine.com:$ENVIRONMENT/$INSTALL.git
# Install gulp and bower
npm install -g gulp bower
# Run Composer to install dependencies
cd wp-content/themes/sage
composer install --prefer-source --no-interaction
npm install
bower install
gulp --production
# Swap out gitignore file to allow dist directory to be included in repo
rm .gitignore
mv .codeshipignore .gitignore
# Remove theme files that don't need to be on production
git rm -rf .bowerrc .editorconfig .jscsrc .jshintrc .travis.yml *.md *.json *.lock config gulpfile.js lang assets
# Push branch to WP Engine master
git add --all
git commit -m "Codeship Deployment"
git push $ENVIRONMENT HEAD:master --force
# Assertible Tests
curl -u $ASSERTIBLE_CODE: "https://assertible.com/deployments" -d'{
"service": "$SERVICE",
"environmentName": "production",
"version": "v1"
}'
*~
.DS_Store
.svn
.cvs
*.bak
*.swp
Thumbs.db
.idea/
# wordpress specific
wp-config.php
wp-content/uploads/
wp-content/blogs.dir/
wp-content/upgrade/*
wp-content/backup-db/*
wp-content/advanced-cache.php
wp-content/wp-cache-config.php
wp-content/cache/*
wp-content/cache/supercache/*
wp-content/debug.log
# wpengine specific
.smushit-status
.gitattributes
_wpeprivate
wp-content/object-cache.php
wp-content/mu-plugins/mu-plugin.php
wp-content/mu-plugins/slt-force-strong-passwords.php
wp-content/mu-plugins/limit-login-attempts
wp-content/mu-plugins/wpengine-common
wp-content/mysql.sql
# large/disallowed file types
# a CDN should be used for these
*.hqx
*.bin
*.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
# Directories that may or may not exist in repo AND should not be on the server
package.json
bower.json
.bower.json
.bowerrc
config.rb
node_modules
.sass-cache
*.md
*.txt
*.ai
*.scss
*.coffee
.gitignore
LICENSE
LICENSE-MIT
gruntfile.js
Gruntfile.js
werker.yml
.editorconfig
css/src
js/src
bower_components/**/foundation/scss/
bower_components/**/jquery/src/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment