-
Notifications
You must be signed in to change notification settings - Fork 1
/
heroku-deploy.sh
executable file
·43 lines (33 loc) · 1.01 KB
/
heroku-deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash -e
function usage(){
echo "Usage: $0 <staging|production>"
}
HEROKU_APP='{{ project_name | lower }}'
ENV='prod'
function set_heroku_environment_to_prod() {
echo "Setting configuration"
heroku config:set ENV=prod --app ${HEROKU_APP}
}
function enable_shell_echo(){
set -x
}
function deploy_code_to_heroku(){
echo "###### Deployment process started ###"
if [ "" != "$(git remote |grep -e '^heroku$')" ]; then
git remote rm heroku
fi
git -c core.askpass=true push https://git.heroku.com/${HEROKU_APP}.git HEAD:master -f
}
function run_database_migration() {
echo "###### Running database migration ###"
heroku run python manage.py migrate --noinput --app ${HEROKU_APP}
}
function run_custom_command() {
echo "### Running custom commands ###"
heroku run python manage.py init_user_group --app ${HEROKU_APP}
heroku run python manage.py run_juju --app ${HEROKU_APP}
}
enable_shell_echo
set_heroku_environment_to_prod
deploy_code_to_heroku
run_database_migration