Skip to content

Instantly share code, notes, and snippets.

@milesmatthias
Created October 6, 2015 21:36
Show Gist options
  • Save milesmatthias/9aca41191c1fa2c11f37 to your computer and use it in GitHub Desktop.
Save milesmatthias/9aca41191c1fa2c11f37 to your computer and use it in GitHub Desktop.
Gulp Build & Netlify deploy script
#!/bin/sh
#
# Usage: ./build.sh staging|production
#
stage=$1
git_branch=`git rev-parse --abbrev-ref HEAD`
if [ $stage = "staging" ]; then
if [ $git_branch = "staging" ]; then
echo "Beginning staging deploy..."
NODE_ENV=staging gulp build --staging && netlify deploy -e staging
echo "...staging deploy complete."
else
echo "you need to be on the staging branch to deploy to staging."
fi
else
if [ $stage = "production" ]; then
if [ $git_branch = "master" ]; then
echo "Beginning production deploy..."
NODE_ENV=production gulp build --production && netlify deploy -e production
echo "...production deploy complete."
else
echo "you need to be on the master branch to deploy to production."
fi
else
echo "You need to provide an environment; either 'staging' or 'production'."
fi
fi
@milesmatthias
Copy link
Author

This is the simple bash script I use to build and deploy our front end for EquityEats.com.

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