This repository was archived by the owner on Jun 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathmake_release.sh
More file actions
executable file
·65 lines (50 loc) · 1.38 KB
/
make_release.sh
File metadata and controls
executable file
·65 lines (50 loc) · 1.38 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
#!/bin/bash
set -eu
#
# This script creates release branch and rolls version in trunk.
#
PROGRAM_NAME=$0
usage() {
printf "usage: %s --new-dev-version=[version]\n" "$PROGRAM_NAME"
printf "new-dev-version: Next version which will be updated to poms in trunk after release branch is created\n"
exit 1
}
check_parameters() {
if [ -z ${NEW_VERSION+x} ]; then usage; fi
}
for i in "$@"
do
case $i in
--new-dev-version=*)
NEW_VERSION="${i#*=}"
shift
;;
*)
;;
esac
done
check_parameters
git fetch --all --tags --prune
git checkout trunk
git pull --rebase
CURRENT_VERSION=$(grep -oPm1 "(?<=<version>)[^<]+" pom.xml)
git checkout -b release/$CURRENT_VERSION
while true; do
read -rp "Do you want to push new release branch(release/$CURRENT_VERSION) to remote?" yn
case $yn in
[Yy]* ) git push --set-upstream origin "release/$CURRENT_VERSION"; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
git checkout trunk
find . -name "pom.xml" -exec sed -i "s|<version>$CURRENT_VERSION</version>|<version>$NEW_VERSION</version>|" {} \;
git commit -a -m "Rolled version for new development version"
while true; do
read -p "Do you want to push new version($NEW_VERSION) to remote?" yn
case $yn in
[Yy]* ) git push; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done