-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·69 lines (60 loc) · 2.11 KB
/
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright (c) 2016 Rocana
#
# 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.
#!/bin/bash
set -x
MVN=$(type -p mvn)
MVN_FLAGS="-B"
if [ -z "${ROCANA_CONFIGURATION_RELEASE_VERSION}" ] || [ -z "${ROCANA_CONFIGURATION_DEVELOPMENT_VERSION}" ]; then
echo "You must set ROCANA_CONFIGURATION_RELEASE_VERSION and ROCANA_CONFIGURATION_DEVELOPMENT_VERSION before running this script."
exit 1
fi
if [ -n "${WORKSPACE}" ]; then
MVN_FLAGS="${MVN_FLAGS} -f ${WORKSPACE}/pom.xml"
MVN_FLAGS="${MVN_FLAGS} -Dmaven.repo.local=${WORKSPACE}/.repository"
fi
# Set the version to the next release
${MVN} ${MVN_FLAGS} \
versions:set \
-DnewVersion=${ROCANA_CONFIGURATION_RELEASE_VERSION} \
-DgenerateBackupPoms=false \
|| exit 1
# Commit and push the version number update
${MVN} ${MVN_FLAGS} \
scm:add \
-Dincludes=**/pom.xml \
-Dexcludes=**/target/**/pom.xml \
scm:checkin \
-Dmessage="ROCANA-BUILD: Preparing for release ${ROCANA_CONFIGURATION_RELEASE_VERSION}" \
|| exit 1
# Deploy the release to the maven repo and tag the release in git
${MVN} ${MVN_FLAGS} \
-Prelease \
deploy \
scm:tag \
-Dtag=release-${ROCANA_CONFIGURATION_RELEASE_VERSION} \
|| exit 1
# Set the version to the next development version
${MVN} ${MVN_FLAGS} \
versions:set \
-DnewVersion=${ROCANA_CONFIGURATION_DEVELOPMENT_VERSION} \
-DgenerateBackupPoms=false \
|| exit 1
# Commit and push the version number update
${MVN} ${MVN_FLAGS} \
scm:add \
-Dincludes=**/pom.xml \
-Dexcludes=**/target/**/pom.xml \
scm:checkin \
-Dmessage="ROCANA-BUILD: Preparing for ${ROCANA_CONFIGURATION_DEVELOPMENT_VERSION} development" \
|| exit 1