-
Notifications
You must be signed in to change notification settings - Fork 323
/
deploy.sh
executable file
·52 lines (43 loc) · 1.24 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
#!/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/yihui/GitHub/maven-repository/
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/yihui/GitHub/maven-repository/repository
# deploy 完成,提交
cd $DEPLOY_PATH
git add .
git commit -m 'deploy'
git push origin $br
# 合并master分支
git checkout master
git merge $br
git add .
git commit -m 'merge'
git push origin master
cd $CURRENT_PATH
}
if [ $arg = 'snapshot' ] || [ $arg = 's' ];then
## 快照包发布
deployFunc snapshot
elif [ $arg = 'release' ] || [ $arg = 'r' ];then
## 正式包发布
deployFunc release
elif [ $arg = 'center' ] || [ $arg = 'c' ];then
## 打包发布到中央仓库
mvn clean deploy -DskipTests=true -P 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