Let’s say that before deploying to Heroku we want to check for any assets changes, and in case we find some we want to do some work.
If there are changes, we want to precompile assets and push any changes back to repo.
Here is example deploy script that does it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Interesting bits:
- Line 3 and 5: To see if there are any changes we need to fetch branches from heroku.
- Line 9: Semaphore CI is rewritting
config/database.yml
which was problematic combined withRAILS_ENV=production
- Line 10,11: We need to do this to make
git push
work. Also, you will need to add extra ssh key to be able to push.