Skip to content

Instantly share code, notes, and snippets.

@seyonv
Created January 30, 2016 23:19
Show Gist options
  • Save seyonv/524f37139d08a079b8f5 to your computer and use it in GitHub Desktop.
Save seyonv/524f37139d08a079b8f5 to your computer and use it in GitHub Desktop.
#!/bin/bash
cd ~/Desktop/diversifyforyou
pushToStaging() {
git add .
git commit -m "$*"
git push
heroku run rake db:migrate --app stagingdfy
heroku apps:open --app stagingdfy
heroku logs -t --app stagingdfy
}
if git rev-parse --abbrev-ref HEAD | grep -q 'staging'; then
if git status | grep -q 'nothing to commit'; then
echo `git status`
else
if [ "$1" != "" ]; then
msg=$1
read -p "This will commit all uncommitted changes, push to Github and CircelCI, which will deploy code to Heroku's Staging Server if all tests pass. Do you want to proceed?[y/n]" choice
if [ "$choice" == "y" ]; then
pushToStaging $msg
elif [ "$choice" == "n" ]; then
echo "Deployment to Staging Cancelled"
else
echo "Invalid Choice. Command Aborted"
fi
else
echo "You must inlude a commit message in quotes. Please try again"
fi
fi
else
echo "Current branch is not staging so you can't deploy. Change branch to staging in order to deploy"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment