This repository has been archived by the owner on Sep 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
release.sh
61 lines (50 loc) · 1.51 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
set -e
BUNDLE=${BUNDLE-"bundle exec"}
MVN=${MVN-"mvn"}
if [ 'GNU' != "$(tar --help | grep GNU | head -1 | awk '{print $1}')" ]; then
echo 'Unable to release: make sure to use GNU tar'
exit 1
fi
if $(ruby -e'require "java"'); then
# Good
echo 'Detected JRuby'
else
echo 'Unable to release: make sure to use JRuby'
exit 1
fi
VERSION=`grep -E '<version>([0-9]+\.[0-9]+\.[0-9]+)</version>' pom.xml | sed 's/[\t \n]*<version>\(.*\)<\/version>[\t \n]*/\1/'`
if [[ -z "$NO_RELEASE" && "$VERSION" != "$(cat $PWD/VERSION)" ]]; then
echo 'Unable to release: make sure the versions in pom.xml and VERSION match'
exit 1
fi
echo 'Cleaning up'
$BUNDLE rake killbill:clean
echo 'Building gem'
$BUNDLE rake build
if [[ -z "$NO_RELEASE" ]]; then
echo 'Pushing the gem to Rubygems'
$BUNDLE rake release
fi
echo 'Building artifact'
$BUNDLE rake killbill:package
ARTIFACT="$PWD/pkg/killbill-litle-$VERSION.tar.gz"
echo "Pushing $ARTIFACT to Maven Central"
if [[ -z "$NO_RELEASE" ]]; then
GOAL=gpg:sign-and-deploy-file
REPOSITORY_ID=ossrh-releases
URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
else
GOAL=deploy:deploy-file
REPOSITORY_ID=sonatype-nexus-snapshots
URL=https://oss.sonatype.org/content/repositories/snapshots/
VERSION="$VERSION-SNAPSHOT"
fi
$MVN $GOAL \
-DgroupId=org.kill-bill.billing.plugin.ruby \
-DartifactId=litle-plugin \
-Dversion=$VERSION \
-Dpackaging=tar.gz \
-DrepositoryId=$REPOSITORY_ID \
-Durl=$URL \
-Dfile=$ARTIFACT \
-DpomFile=pom.xml