-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease-master.sh
More file actions
executable file
·152 lines (115 loc) · 4.13 KB
/
release-master.sh
File metadata and controls
executable file
·152 lines (115 loc) · 4.13 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash
#
# Copyright (c) 2016 org.NLP4L
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
if [ -z $1 ] || [ -z $2 ]; then
echo "Usage: ./release-master.sh <this_release> <next_release>"
echo " ex) ./release-master.sh 1.1 1.2"
exit 1
fi
# e.g. 1.1, 1.2
THIS_BRANCH_NUM=$1
NEXT_BRANCH_NUM=$2
# e.g. 1.1.0, 1.2.0, 1.1.1
THIS_REL_NUM=${THIS_BRANCH_NUM}.0
NEXT_REL_NUM=${NEXT_BRANCH_NUM}.0
NEXT_BUGFIX_NUM=${THIS_BRANCH_NUM}.1
#echo "THIS_REL_NUM : $THIS_REL_NUM"
#echo "NEXT_REL_NUM : $NEXT_REL_NUM"
#echo "NEXT_BUGFIX_NUM : $NEXT_BUGFIX_NUM"
# e.g. 1.1-dev, 1.2-dev
THIS_DEV_NUM=${THIS_BRANCH_NUM}-dev
NEXT_DEV_NUM=${NEXT_BRANCH_NUM}-dev
#echo "THIS_DEV_NUM : $THIS_DEV_NUM"
#echo "NEXT_DEV_NUM : $NEXT_DEV_NUM"
echo -n "Have you executed ant test and has it successfully done? (y/n) "
read ANS
if [ $ANS != "y" ]; then
exit 1
fi
DATE_Y=$(date +"%Y")
DATE_M=$(date +"%m")
DATE_D=$(date +"%d")
THIS_REL_DATE="${DATE_Y}-${DATE_M}-${DATE_D}"
# make the new release branch from master
git checkout master
git checkout -b "rel-${THIS_BRANCH_NUM}"
# set the proper version number and date
sed -e s/$THIS_DEV_NUM/$THIS_REL_NUM/ version.properties > version.properties.temp
mv version.properties.temp version.properties
sed -e s/$THIS_DEV_NUM/$THIS_REL_NUM/ CHANGES.txt | sed -e s/YYYY-MM-DD/$THIS_REL_DATE/ > CHANGES.txt.temp
mv CHANGES.txt.temp CHANGES.txt
# commit the modification
git add .
git commit -m "prepare rel-${THIS_REL_NUM}"
git push --set-upstream origin "rel-${THIS_BRANCH_NUM}"
# tag the commit point to rel-${THIS_REL_NUM}
git tag -a "rel-${THIS_REL_NUM}" -m "release tag for ${THIS_REL_NUM}"
git push origin "rel-${THIS_REL_NUM}"
# merge the change to master
git checkout master
git merge "rel-${THIS_BRANCH_NUM}"
# prepare the next release on master
sed -e "1d" CHANGES.txt > CHANGES.txt.temp
cat<<EOF> CHANGES.txt
NLP4L/framework change history
========== ${NEXT_DEV_NUM} / YYYY-MM-DD ===================================
Important Notice
New Features & Improvements
Bug Fixes
API Changes
Javadoc Fixes
Project environments
Tests
Deprecated/Deleted Features
Others
EOF
cat CHANGES.txt.temp >> CHANGES.txt
rm CHANGES.txt.temp
sed -e s/$THIS_REL_NUM/$NEXT_DEV_NUM/ version.properties > version.properties.temp
mv version.properties.temp version.properties
git add .
git commit -m "prepare the next release ${NEXT_BRANCH_NUM}"
git push
# prepare the next bug fix release on the release branch
git checkout "rel-${THIS_BRANCH_NUM}"
sed -e "1d" CHANGES.txt > CHANGES.txt.temp
cat<<EOF> CHANGES.txt
NLP4L/framework change history
========== ${NEXT_BUGFIX_NUM} / YYYY-MM-DD ===================================
Important Notice
New Features & Improvements
Bug Fixes
API Changes
Javadoc Fixes
Project environments
Tests
Deprecated/Deleted Features
Others
EOF
cat CHANGES.txt.temp >> CHANGES.txt
rm CHANGES.txt.temp
sed -e s/$THIS_REL_NUM/$NEXT_BUGFIX_NUM/ version.properties > version.properties.temp
mv version.properties.temp version.properties
git add .
git commit -m "prepare the next release ${NEXT_BUGFIX_NUM}"
git push
echo -e "\\n\\n\\nThe rel-${THIS_REL_NUM} has been almost prepared. Please execute the following to finalize.\\n"
echo "1. git checkout rel-${THIS_REL_NUM}"
echo "2. build nlp4l-framework-${THIS_REL_NUM}.zip file by executing activator dist."
echo "3. Go to https://github.com/NLP4L/framework/releases/tag/rel-${THIS_REL_NUM}"
echo "4. click [Edit tag] button and drop down the zip file to the drop down box and click [Publish release]"
echo "5. to go back master, git checkout master"
echo -e "\\nThe download link will be https://github.com/NLP4L/framework/releases/download/rel-${THIS_REL_NUM}/nlp4l-framework-${THIS_REL_NUM}.zip"