Created
October 6, 2015 21:36
-
-
Save milesmatthias/9aca41191c1fa2c11f37 to your computer and use it in GitHub Desktop.
Gulp Build & Netlify deploy script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the simple bash script I use to build and deploy our front end for EquityEats.com.