Skip to content

Instantly share code, notes, and snippets.

@jamesfacts
Created May 4, 2017 23:06
Show Gist options
  • Save jamesfacts/23333a7ee5cb048196304c416f78e1ca to your computer and use it in GitHub Desktop.
Save jamesfacts/23333a7ee5cb048196304c416f78e1ca to your computer and use it in GitHub Desktop.
Deploy scripts for Sage + WPEngine through Codeship Raw
# Setup
# Get around restriction on shallow pushes by WP Engine
git filter-branch -- --all
git checkout staging [OR ANY OTHER BRANCH]
# Add User Data
git config --global user.name "codeship-username"
git config --global user.email "[email protected]"
# Combine remote git servers
git remote add servers $REPO_STAGING
git remote set-url --add --push servers $REPO_STAGING
# Install needed modules
nvm use stable
npm install -g yarn
# Move repo files to a named folder
mkdir $FOLDERNAME
shopt -s extglob
mv !($FOLDERNAME) $FOLDERNAME
# Exclude development-only files from commit
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
yarn
yarn run build:production
# Deploy
git add --all :/
git commit -m "DEPLOYMENT"
git push servers HEAD:master --force
# If this is the first time you're running the deployment, you might try this next line instead in case you get a missing branch error:
# git push servers HEAD:refs/heads/master --force

Add these to your Codeship pipeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment