-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·47 lines (38 loc) · 1.07 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
#!/bin/bash
if [ $# != 1 ];then
echo 'deploy argument [snapshot(s for short) | release(r for short) ] needed!'
exit 0
fi
## deploy参数,snapshot 表示快照包,简写为s, release表示正式包,简写为r
arg=$1
DEPLOY_PATH=/Users/mine/GitHub/source/
CURRENT_PATH=`pwd`
deployFunc(){
br=$1
## 快照包发布
cd $DEPLOY_PATH
## 切换对应分支
git checkout $br
cd $CURRENT_PATH
# 开始deploy
mvn clean deploy -Dmaven.test.skip -DaltDeploymentRepository=self-mvn-repo::default::file:/Users/mine/GitHub/source/repository
# deploy 完成,提交
cd $DEPLOY_PATH
git add -am 'deploy'
git push origin $br
# 合并master分支
git checkout master
git merge $br
git commit -am 'merge'
git push origin master
cd $CURRENT_PATH
}
if [ $arg = 'snapshot' ] || [ $arg = 's' ];then
## 快照包发布
deployFunc snapshot
elif [ $arg = 'release' ] || [ $arg = 'r' ];then
## 正式包发布
deployFunc release
else
echo 'argument should be snapshot(s for short) or release(r for short). like: `sh deploy.sh snapshot` or `sh deploy.sh s`'
fi