-
Notifications
You must be signed in to change notification settings - Fork 39
/
release.sh
78 lines (57 loc) · 1.88 KB
/
release.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
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
echo "============================= RELEASE START..."
## 版本号信息(需要手动指定)
oldVersion="0.1.27"
newVersion="0.1.28"
projectName="nlp-hanzi-similar"
# release 项目版本
## snapshot 版本号
snapshot_version=${oldVersion}"-SNAPSHOT"
## 新的版本号
release_version=${oldVersion}
mvn versions:set -DgroupId=com.github.houbb -DartifactId=${projectName} -DoldVersion=${snapshot_version} -DnewVersion=${release_version}
mvn -N versions:update-child-modules
mvn versions:commit
echo "1. RELEASE ${snapshot_version} TO ${release_version} DONE."
# 推送到 github
git add .
git commit -m "release branch ${oldVersion}"
git push
git status
echo "2. PUSH TO GITHUB DONE."
# 推送到 maven 中央仓库
mvn clean deploy -P release
echo "3. PUSH TO MAVEN CENTER DONE."
# 合并到 master 分支
branchName="release_"${oldVersion} # 分支名称
git checkout master
git pull
git checkout ${branchName}
git rebase master
git checkout master
git merge ${branchName}
git push
echo "4. MERGE TO MASTER DONE."
# 拉取新的分支
newBranchName="release_"${newVersion}
git branch ${newBranchName}
git checkout ${newBranchName}
git push --set-upstream origin ${newBranchName}
echo "5. NEW BRANCH DONE."
# 修改新分支的版本号
## snapshot 版本号
snapshot_new_version=${newVersion}"-SNAPSHOT"
mvn versions:set -DgroupId=com.github.houbb -DartifactId=${projectName} -DoldVersion=${release_version} -DnewVersion=${snapshot_new_version}
mvn -N versions:update-child-modules
mvn versions:commit
git add .
git commit -m "modify branch ${release_version} TO ${snapshot_new_version}"
git push
git status
echo "6. MODIFY ${release_version} TO ${snapshot_new_version} DONE."
echo "============================= RELEASE END..."
# 使用方式:
# 1. 赋值权限: chmod +x ./release.sh
# 2. 执行: ./release.sh
# Last Update Time: 2018-01-20 12:07:34
# Author: houbb