-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease-bugfix.sh
executable file
·99 lines (78 loc) · 2.95 KB
/
release-bugfix.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
#
# Copyright (c) 2014 RONDHUIT Co.,Ltd.
#
# 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 ] || [ -z $3 ]; then
echo "Usage: ./release-bugfix.sh <this_branch> <this_release> <next_release>"
echo " ex) ./release-bugfix.sh 1.1 1.1.1 1.1.2"
exit 1
fi
# e.g. 1.1.1, 1.1.2
THIS_BRANCH_NUM=$1
THIS_REL_NUM=$2
NEXT_REL_NUM=$3
#echo "THIS_REL_NUM : $THIS_REL_NUM"
#echo "NEXT_REL_NUM : $NEXT_REL_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 sure on the target release branch
git checkout "rel-${THIS_BRANCH_NUM}"
# set the proper release date
sed -e s/YYYY-MM-DD/$THIS_REL_DATE/ CHANGES.txt > 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}"
# 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
RONDHUIT COMMONS Java Library change history
========== ${NEXT_REL_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_REL_NUM/ version.properties > version.properties.temp
mv version.properties.temp version.properties
git add .
git commit -m "prepare the next release ${NEXT_REL_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 RONDHUIT-COMMONS-${THIS_REL_NUM}.jar file by executing ant"
echo "3. Go to https://github.com/kojisekig/rondhuit-commons/releases/tag/rel-${THIS_REL_NUM}"
echo "4. click [Edit tag] button and drop down the jar file to the drop down box and click [Publish release]"
echo "5. git checkout master"
echo -e "\\nThe download link will be https://github.com/kojisekig/rondhuit-commons/releases/download/rel-${THIS_REL_NUM}/RONDHUIT-COMMONS-${THIS_REL_NUM}.jar"