forked from theodoreLee/goose
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathautorelease
executable file
·74 lines (62 loc) · 1.47 KB
/
autorelease
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
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
name="Capfile"
deploy_dir="deploy"
group=ad3
tmp_file="$deploy_dir/$name.tmp"
conf_file="$deploy_dir/$name.conf"
function createCap(){
details=`awk -F ":" -v g=$group '$1==g {print $2}' $conf_file`
echo $details
IFS=,
ary=($details)
#count=${#ary[@]}
user=${ary[0]}
adminuser=${ary[1]}
port=${ary[2]}
hosts=${ary[3]}
ahost=${ary[@]:3:100}
IFS=
hosts=`echo $ahost|sed 's/ /,/g'`
echo "use group : "$group
echo "user: "$group
echo "admin_runner : "$adminuser
echo "port : "$port
echo "hosts : "$hosts
cp $tmp_file $group_file
sed -i "s/##USER##/$user/g" $group_file
sed -i "s/##ADMIN_RUNNER##/$adminuser/g" $group_file
sed -i "s/##PORT##/$port/g" $group_file
sed -i "s/##HOSTS##/$hosts/g" $group_file
}
function createRelease(){
cd release
git pull origin master
git rm ./*.jar
git rm config/*
git rm scripts/*
cd ..
sbt clean update package-dist
cd release
git status
git add .
git commit -m "make release"
git push origin master
cd ..
}
if [ $# = 0 ] ; then
echo "Usage : ./deploy.sh group1 group2.."
else
for i in "$@"
do
if [ "$i" == "tmp" ] || [ "$i" == "conf" ]; then
echo "Group name can not be tmp or conf"
else
group=$i
#group_file="$deploy_dir/$name.$group"
group_file="$name"
createCap $i
#createRelease $i
cap -f $group_file deploy
fi
done
fi