-
Notifications
You must be signed in to change notification settings - Fork 1
/
release.sh
executable file
·36 lines (26 loc) · 1.01 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
#!/bin/bash
# Preamble
PROGNAME=$(basename $0)
function error_exit
{
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
exit ${2:-1}
}
# Argument validation
[[ -z "$1" ]] && error_exit "Version number must be provided" 1
NVER=$1
# Go to the build directory
BUILDDIR=derquinse-common
cd $(dirname $0)/$BUILDDIR || error_exit "Unable to change to build directory $BUILDDIR" 2
[[ -f pom.xml ]] || error_exit "POM not found in build directory $BUILDDIR" 3
# Set version number
mvn -DnewVersion=$NVER versions:set || error_exit "Unable to set version to $NVER" 4
# Verify build
mvn -Psonatype-oss-release clean verify || error_exit "Verify build failed" 5
# Commit
git commit -a -m "Version $NVER" || error_exit "Unable to commit" 6
# Install and deploy
mvn -Psonatype-oss-release install deploy || error_exit "Unable to install and deploy version $NVER" 7
# Tag and push
git tag -a $BUILDDIR-$NVER -m "Version $NVER" || error_exit "Unable to tag version $NVER" 8
git push --follow-tags || error_exit "Unable to tag version $NVER" 9