Skip to content

Instantly share code, notes, and snippets.

@piecioshka
Created March 18, 2019 21:13
Show Gist options
  • Save piecioshka/b7fba8dd30e256411892c52222d4c770 to your computer and use it in GitHub Desktop.
Save piecioshka/b7fba8dd30e256411892c52222d4c770 to your computer and use it in GitHub Desktop.
[deploy script]
#!/bin/bash
set -o errexit # Exit on error
git stash save 'Before deploy' # Stash all changes before deploy
git checkout deploy
git merge master --no-edit # Merge in the master branch without prompting
npm run build # Generate the bundled Javascript and CSS
if $(git commit -am Deploy); then # Commit the changes, if any
echo 'Changes Committed'
fi
git push heroku deploy:master # Deploy to Heroku
git checkout master # Checkout master again
git stash pop # And restore the changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment