-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease_on_linux.sh
executable file
·111 lines (93 loc) · 2.93 KB
/
release_on_linux.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
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
phenotips_release_version="${1}"
phenotips_snapshot_version="${2}"
_const_example_string="Ex ./release_on_linux.sh 1.4.7 1.4"
if [ "${1}" = "--help" ] || [ "${1}" = "-h" ] ; then
echo "Usage: release_on_linux.sh RELEASE_VERSION SNAPSHOT_VERSION"
echo "${_const_example_string}"
exit 0
fi
if [ -z "${phenotips_release_version}" ]; then
echo "PhenoTips release version cannot be empty. ${_const_example_string}"
exit 1
fi
if [ -z "${phenotips_snapshot_version}" ]; then
echo "PhenoTips next SNAPSHOT version cannot be empty. ${_const_example_string}"
exit 1
fi
export PROJECT=phenotips
export PT_VERSION="${phenotips_release_version}"
export SNAPSHOT_VERSION="${phenotips_snapshot_version}-SNAPSHOT"
export GPG_TTY="$(tty)"
while true; do
printf "\nPROJECT=${PROJECT}\n"
printf "PT_VERSION=${PT_VERSION}\n"
printf "SNAPSHOT_VERSION=${SNAPSHOT_VERSION}\n"
printf "GPG_TTY=${GPG_TTY}\n\n"
printf "If the above variables look correct,\n"
printf "Release PhenoTips [${PT_VERSION}]"
printf " and set next SNAPSHOT version to [${SNAPSHOT_VERSION}]? [(y)es/(n)o]: "
read -r yn
case "${yn}" in
[Yy]*)
break
;;
[Nn]*)
exit 0
break
;;
*) echo "Please answer y (yes) or n (no) " ;;
esac
done
PT_TAG="${PROJECT}-${PT_VERSION}"
if [ "$(git tag --list "${PT_TAG}")" ]; then
while true; do
printf "\nTag [${PT_TAG}] already exists, delete? [(y)es/(n)o]: "
read -r yn
case "${yn}" in
[Yy]*)
git tag -d "${PT_TAG}"
break
;;
[Nn]*)
exit 0
break
;;
*) echo "Please answer y (yes) or n (no) " ;;
esac
done
fi
RELEASE_BRANCH="release-${PT_VERSION}"
if [ "$(git branch --list "${RELEASE_BRANCH}")" ]; then
while true; do
printf "\nBranch [${RELEASE_BRANCH}] already exists, delete? [(y)es/(n)o]: "
read -r yn
case "${yn}" in
[Yy]*)
git branch -D "${RELEASE_BRANCH}"
break
;;
[Nn]*)
exit 0
break
;;
*) echo "Please answer y (yes) or n (no) " ;;
esac
done
fi
git clean -dxf
mvn clean
git checkout -b "${RELEASE_BRANCH}"
sed -i -r -e "s/<phenotips.version>(.*)<\/phenotips.version>/<phenotips.version>${PT_VERSION}<\/phenotips.version>/" pom.xml
git add pom.xml
git commit -m '[release] Set the phenotips.version to the right value'
mvn release:prepare -DreleaseVersion="${PT_VERSION}" \
-DdevelopmentVersion="${SNAPSHOT_VERSION}" \
-Dtag="${PT_TAG}" \
-Pfunctional-tests && \
git checkout "${PT_TAG}" && \
git tag -d "${PT_TAG}" && \
git tag -s -m "Tagging ${PT_TAG}" "${PT_TAG}" && \
git push -f origin "${PT_TAG}" && \
mvn release:perform
mvn release:clean -Pfunctional-tests