Fix stash handling in deploy script

This commit is contained in:
Brian Beck 2017-10-05 20:48:51 -07:00
parent 759310a2a6
commit bc2a5655d8

View file

@ -7,7 +7,7 @@ RESET='\033[0m'
# Fail if the `heroku` remote isn't there.
git remote show heroku
git stash # Stash uncommitted changes.
STASH_OUTPUT=$(git stash) # Stash uncommitted changes.
git checkout -B deploy # Force branch creation/reset.
npm run build
git add -f lib # Force add ignored files.
@ -17,6 +17,8 @@ git push -f heroku deploy:master
git rm -r --cached lib # Otherwise switching branches will remove them.
git checkout - # Switch back to whatever branch we came from.
git branch -D deploy # Just to prevent someone accidentally pushing to GitHub.
git stash pop --index || true # Restore uncommitted changes, OK if none.
if [[ $STASH_OUTPUT != "No local changes"* ]]; then
git stash pop --index # Restore uncommitted changes.
fi
echo -e "\n${GREEN}✔︎ Successfully deployed.${RESET}"