-
Notifications
You must be signed in to change notification settings - Fork 75
/
deploy-to-sonatype.sh
executable file
·54 lines (45 loc) · 1.9 KB
/
deploy-to-sonatype.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
#!/bin/bash
#mch***@isc.upenn.edu
GPG_KEY=1D3F3E9E30C7F312
# Only invoke the deployment to Sonatype when it's not a PR and only for master
if [ "$TRAVIS_PULL_REQUEST" == "true" ]; then
echo -e "Skipping Sonatype deployment because this is a pull request"
exit 0
fi
# TODO temp allow travis branch to deploy
#[ "$TRAVIS_BRANCH" != "master" ]
# echo -e "Skipping Sonatype deployment because this is not the master branch"
# exit 0
#fi
GROUPER_VERSION=$(perl -e '$_ = $ENV{q~TRAVIS_TAG~}; print $1 if /^GROUPER_RELEASE_((\d+\.)+\d+(rc\d+)?)$/')
if [ $? -ne 0 ]; then
echo -e "Failed to parse travis tag '$TRAVIS_TAG' against /^GROUPER_RELEASE_((\d+\.)+\d+(rc\d+)?)$/"
exit 129
fi
if [ -z "$GROUPER_VERSION" ]; then
echo -e "Travis tag '$TRAVIS_TAG' did not match pattern /^GROUPER_RELEASE_((\d+\.)+\d+(rc\d+)?)$/"
exit 130
fi
echo -e "Extracted grouper version '$GROUPER_VERSION' from tag '$TRAVIS_TAG'"
case "${TRAVIS_JOB_NUMBER}" in
*\.1)
echo -e "Setting Grouper version to $GROUPER_VERSION in Maven pom files"
cp travis/mvn.settings.xml $HOME/.m2/settings.xml
mvn -f ./grouper-parent versions:set -DnewVersion=$GROUPER_VERSION
if [ $? -ne 0 ]; then
echo -e "Failed to set pom versions to $GROUPER_VERSION"
exit 131
fi
echo -e "building and deploying release artifacts to Sonatype for Travis job ${TRAVIS_JOB_NUMBER}"
mvn -f ./grouper-parent clean compile package deploy -Prelease -Dgpg.keyname=$GPG_KEY
# not needed
#-Dgpg.publicKeyring=$TRAVIS_BUILD_DIR/pubring.gpg -Dgpg.secretKeyring=$TRAVIS_BUILD_DIR/secring.gpg
#-Dgpg.passphrase=$PASSPHRASE
if [ $? -ne 0 ]; then
echo -e "Failed to build or deploy the release version"
exit 132
fi
echo -e "Successfully deployed release artifacts to Sonatype under Travis job ${TRAVIS_JOB_NUMBER}";;
*)
echo -e "Skipping Sonatype deployment because job ${TRAVIS_JOB_NUMBER} does not match *.1"
esac