-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-to-dbx.sh
executable file
·57 lines (43 loc) · 1.46 KB
/
deploy-to-dbx.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
#!/bin/bash
TAG=
GROUP="hu/dbx"
ARTIFACT="kompot"
while [ $# -gt 0 ]
do
case $1 in
--tag) TAG=$2
shift
;;
-*)
echo "WARN: Unknown option (ignored): $1" >&2
shift
;;
*) # no more options. Stop while loop
break
;;
esac
shift
done
if [ -z "$TAG" ]; then
echo "Tag version is necessary!"
exit -1
fi
echo "Uploading version $TAG to maven!"
git checkout $TAG
echo "-----------------------------------------------"
mvn clean package
# ha elszállt a maven task, akkor ne csináljunk semmit.
if [ "$?" -ne 0 ] ; then
exit -1
fi
cd ./target
a=$(find . -type f -name 'kompot-[0-9]*.[0-9]*.[0-9]*.jar')
b=${a#*-}
VERSION=${b%.*}
cp ../pom.xml ./$ARTIFACT-$VERSION.pom
REMOTE_DIRECTORY="/home/ubuntu/maven/repository/$GROUP/$ARTIFACT/$VERSION"
shasum $ARTIFACT-$VERSION.jar > $ARTIFACT-$VERSION.jar.sha1
shasum $ARTIFACT-$VERSION.pom > $ARTIFACT-$VERSION.pom.sha1
cd ..
ssh -i ~/.ssh/dbx.pem ubuntu@services.dbx.hu "mkdir -p $REMOTE_DIRECTORY"
scp -i ~/.ssh/dbx.pem ./target/$ARTIFACT-$VERSION.jar ./target/$ARTIFACT-$VERSION.jar.sha1 ./target/$ARTIFACT-$VERSION.pom ./target/$ARTIFACT-$VERSION.pom.sha1 ubuntu@services.dbx.hu:$REMOTE_DIRECTORY