Last active
June 2, 2016 16:04
-
-
Save nafu/32d218a317b4b6e9afa5 to your computer and use it in GitHub Desktop.
CircleCIでherokuのprebootの設定を自動で行う ref: http://qiita.com/nafu/items/4c480934871bbdfb56e9
This file contains 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
deployment: | |
production: | |
branch: master | |
commands: | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku features:disable preboot --app production; else heroku features:enable preboot --app production; fi | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku maintenance:on --app production; fi | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku scale worker=0 --app production; fi | |
- git push -f [email protected]:production.git $CIRCLE_SHA1:refs/heads/master | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku run 'rake db:migrate' --app production; fi | |
- heroku run 'rake db:seed' --app production | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku maintenance:off --app production; fi | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku features:enable preboot --app production; fi |
This file contains 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 | |
# get compare SHA1 | |
compare_url=$CIRCLE_COMPARE_URL | |
compare_ids=${compare_url#*compare/} | |
# set NEED_MAINTENANCE_MODE if schema.rb is changed | |
if git diff --name-only $compare_ids | grep -q 'schema.rb'; then | |
echo 1 | |
else | |
echo 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment