-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbump-version.sh
More file actions
executable file
·52 lines (41 loc) · 1.01 KB
/
bump-version.sh
File metadata and controls
executable file
·52 lines (41 loc) · 1.01 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
#!/usr/bin/env bash
# exit if command fails
set -e
if [ -z "$1" ]
then
echo 'Version parameter not given. Invoke as e.g. ./bump-version.sh 1.0.0'.
exit 1
fi
# function to read `y` (yes) or `n` (no).
function yes_or_no {
while true; do
read -p "$* [y/n]: " yn
case $yn in
[Yy]*) return 1 ;;
[Nn]*) echo "Aborted" ; return 0 ;;
esac
done
}
VERSION=$1
echo "Changing version to $VERSION"
echo 'Updating pom.xml...'
mvn versions:set -DnewVersion=$VERSION
echo 'Updating README.md...'
sed -i -e "s|MappingWeaver-.*\.jar|MappingWeaver-$VERSION.jar|g" README.md
if [ ! "$(yes_or_no 'Do you also want to add the version to CHANGELOG.md?')" ]
then
changefrog -n $VERSION
fi
if [[ $VERSION == testrelease-* ]] ; then
tagname=$VERSION
else
tagname="v$VERSION"
fi
if [ ! "$(yes_or_no Do you also want to commit the changes, create a git tag $tagname and push it?)" ]
then
git add pom.xml README.md CHANGELOG.md
git commit -m "Update version to $VERSION"
git push origin
git tag $tagname
git push origin $tagname
fi