-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
64 lines (51 loc) · 1.05 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
59
60
61
62
63
64
function get_app_git() {
while read line
do
if [[ "$line" == "Git URL:"* ]]
then
echo "$line" | egrep -o '(http.+)'
return
fi
done <<<"$(heroku apps:info --app $1)"
}
apps=()
function get_heroku_app_names() {
while read line
do
if [ "$line" = "=== My Apps" ] || [ "$line" = "" ]
then
echo ""
else
apps+=("$line")
fi
done <<<"$(heroku apps)"
}
function deploy() {
get_heroku_app_names
while read line
do
while IFS='=' read -ra ADDR
do
app_exists=false
for app_name in "${apps[@]}"
do
if [ "$app_name" = "jddv-proxy-${ADDR[0]}" ]
then
app_exists=true
break
fi
done
if [ "$app_exists" = "true" ]
then
echo "Proxy ${ADDR[0]} already exists.\n"
else
echo "Proxy ${ADDR[0]} does not exist, creating 'jddv-proxy-${ADDR[0]}'...\n"
heroku create jddv-proxy-${ADDR[0]} --buildpack https://github.com/heroku/heroku-buildpack-jvm-common.git
fi
app_git=$(get_app_git jddv-proxy-${ADDR[0]})
echo "App git is: $app_git"
git push ${app_git} master:master
done <<< "$line"
done < exchange_servers.properties
}
deploy