Created
March 10, 2012 00:22
-
-
Save TheEmpty/2009437 to your computer and use it in GitHub Desktop.
Heroku Deploy
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/bash | |
| ENV='staging' | |
| BRANCH='master' | |
| GOT=`git status` | |
| EXPECTED="# On branch master | |
| nothing to commit (working directory clean)" | |
| if [ "$GOT" != "$EXPECTED" ] | |
| then | |
| echo 'Please commit your changes to the git repository before deploying to Heroku' | |
| exit | |
| fi | |
| EXEC=`bundle exec rake RAILS_ENV=$ENV RAILS_GROUPS=assets assets:precompile` | |
| GA=`git add .` | |
| GM=`git commit -m 'Automatic heroku deploy'` | |
| git push heroku $BRANCH --force | |
| # TODO: only if a migration was added | |
| echo 'Deployed, now migrating' | |
| heroku rake db:migrate | |
| echo 'Database migrated, removing pre-compiled files' | |
| git reset --hard HEAD^ | |
| echo 'All done, application deployed!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment