-
Notifications
You must be signed in to change notification settings - Fork 4
/
prepare_release.sh
executable file
·52 lines (44 loc) · 1.35 KB
/
prepare_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
#!/bin/bash
GIT_BRANCH=$(git branch --show-current)
CHECK_FOR_CLEAN_BRANCH=true
while getopts "v:c" opt; do
case $opt in
c)
echo "Not checking for clean branch (-c)"
CHECK_FOR_CLEAN_BRANCH=false
;;
v)
echo "Changing parent pom version to: $OPTARG"
mvn versions:set -DnewVersion="${OPTARG}" -DupdateMatchingVersions=false
;;
?)
echo "Invalid option: -${OPTARG}."
exit 1
;;
esac
done
if [[ "$CHECK_FOR_CLEAN_BRANCH" = true ]]; then
echo "Checking for clean git checkout. Disable with '-c'"
if [[ "master" != "$GIT_BRANCH" ]]; then
echo "Not on 'master' branch. You have 5 seconds to abort."
sleep 5
fi
if [[ -n $(git cherry -v) ]]; then
echo "Detected unpushed commits. Exit"
exit 1
fi
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
echo "Uncommited changes detected. Exit"
exit 1
fi
else
echo "Not checking for clean branch CHECK_FOR_CLEAN_BRANCH=$CHECK_FOR_CLEAN_BRANCH"
fi
# replace module -SNAPSHOT version with release version (non-SNAPSHOT)
mvn versions:set -DremoveSnapshot
mvn versions:set -DremoveSnapshot -pl cdoc2-schema
mvn versions:set -DremoveSnapshot -pl cdoc2-client
mvn versions:set -DremoveSnapshot -pl cdoc2-lib
mvn versions:set -DremoveSnapshot -pl cdoc2-cli
# build and install into local maven package repository
mvn install