-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·100 lines (86 loc) · 2.76 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·100 lines (86 loc) · 2.76 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
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
#!/bin/bash
#
# release.sh — drives maven-release-plugin against the root reactor.
#
# Performs `release:prepare` followed by `release:perform`, signing the
# generated artifacts with GPG and deploying them to whatever target is
# configured in <distributionManagement> + ~/.m2/settings.xml (typically
# Artifactory or Maven Central staging).
#
# Usage:
# ./release.sh --password <pgp passphrase>
# ./release.sh # prompts for the passphrase
#
# The companion wrapper newRelease.sh bakes the passphrase in for local
# convenience; it is gitignored and must never be committed.
#
# GitHub release creation and release-notes generation are intentionally
# left out — do those manually after the artifacts are published.
#
set -e
PROPERTY_FILE=./release.properties
function help() {
cat <<'USAGE'
Usage: release.sh [OPTIONS]
Creates a signed release of the root reactor.
Options:
--help Show this message
--password <pgp password> PGP passphrase used to sign release artifacts
USAGE
}
POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--password)
password="$2"
shift
shift
;;
--help)
help
exit
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [[ "x${password}" == "x" ]]; then
echo "Type pgp password:"
read -s password
echo
fi
if [[ "x${password}" == "x" ]]; then
echo "Password is empty"
exit 1
fi
# prepare release (computes the next tag/version, commits the bumped poms,
# tags the repo, advances to the next SNAPSHOT, writes release.properties)
mvn clean release:prepare -Psign \
-Darguments=-Dgpg.passphrase=${password} \
-Dresume=false -DskipTests
# get release tag name and versions for the post-release summary
tagName=`cat $PROPERTY_FILE | grep "scm.tag" | grep -i -v -E "scm.tagNameFormat" | cut -d'=' -f2`
tagVersion=`cat $PROPERTY_FILE | grep "project.rel.com.github.vzakharchenko..atlassian-runtime-bridge" | cut -d'=' -f2`
tagDevVersion=`cat $PROPERTY_FILE | grep "project.dev.com.github.vzakharchenko..atlassian-runtime-bridge" | cut -d'=' -f2`
if [[ "x${tagVersion}" == "x" ]]; then
echo "tagVersion is empty"
exit 1
fi
if [[ "x${tagName}" == "x" ]]; then
echo "tagName is empty"
exit 1
fi
# perform release (checks out the tagged revision and deploys the
# already-prepared release artifacts, GPG-signed)
mvn -Psign clean release:perform \
-Darguments=-Dgpg.passphrase=${password} \
-DskipTests
git pull
echo
echo "Released ${tagName} (${tagVersion}); next development iteration: ${tagDevVersion}"
echo "Artifacts are now signed and deployed."
echo "Create the GitHub release for ${tagName} manually if needed."