-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
61 lines (39 loc) · 1.32 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Alumni Web Client Deploy
git remote add heroku-prod [email protected]:alumni-db-frontend.git
git remote add heroku-dev [email protected]:alumni-db-frontend-dev.git
create_tmp_branch(){
# Create a temp branch to deploy from.
git checkout -b tmp-deploy
git checkout tmp-deploy
# Un-ignoring dist for a second.
sed '/dist/d' .gitignore > .gitignore.new && mv .gitignore.new .gitignore
}
branch_name=$(git rev-parse --abbrev-ref HEAD)
echo $branch_name
if [ $branch_name = "development" ]
then
create_tmp_branch
# generate dist folder
grunt build-staging
# push to heroku
git add --all && git commit -a -m 'Deploy message.'
yes | git push heroku-dev `git subtree split --prefix dist tmp-deploy`:master --force
# Switch back to master
git checkout development
# Remove tmp-deploy
git branch -D tmp-deploy
elif [ $branch_name = "master" ]
then
create_tmp_branch
# generate dist folder
grunt build-production
# push to heroku
git add --all && git commit -a -m 'Deploy message.'
yes | git push heroku-prod `git subtree split --prefix dist tmp-deploy`:master --force
# Switch back to master
git checkout master
# Remove tmp-deploy
git branch -D tmp-deploy
else
echo 'wrong arguments'
fi