Skip to content

Instantly share code, notes, and snippets.

@tnchuntic
Forked from ZachWatkins/codeshipbuild.sh
Created March 21, 2019 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnchuntic/155fa6d5a794251ccaff762c04fa383c to your computer and use it in GitHub Desktop.
Save tnchuntic/155fa6d5a794251ccaff762c04fa383c to your computer and use it in GitHub Desktop.
# Get around shallow update restriction
if [ -f ${HOME}/clone/.git/shallow ]; then git fetch --unshallow; fi
# Add User Data
git config --global user.name "wpengine-git-push-user-name"
git config --global user.email "my-wpengine-account-email-address"
# Add servers
git remote add servers $WPENGINE_GIT_PUSH_REMOTE
git remote set-url --add --push servers $WPENGINE_GIT_PUSH_REMOTE
git remote set-url --add --push servers $WPENGINE_GIT_PUSH_REMOTE_2
git remote set-url --add --push servers $WPENGINE_GIT_PUSH_REMOTE_3
# Install needed modules
npm install -g grunt-cli
npm install -g ruby
npm install -g sass
# Re-create folder structure of root directory of a WordPress server just for this plugin or theme
# Move repo files to a named folder
mkdir $FOLDERNAME
shopt -s extglob
mv !($FOLDERNAME) $FOLDERNAME
# Exclude development-only files from commit by enforcing our codeshipignore file instead
rm .gitignore
mv .codeshipignore $FOLDERNAME/.gitignore
# Move named folder into a structure identical to the root directory of a WordPress server
mkdir -p $DIRECTORY
mv $FOLDERNAME $DIRECTORY
cd $DIRECTORY/$FOLDERNAME/
# Build - production only
npm start
# Build - staging only
npm install
composer install
grunt develop
npm run checkwp
# Release - production only
grunt release
# Deploy
git add --all :/
git commit -m "DEPLOYMENT"
git push servers HEAD:refs/heads/master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment