-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy-unstable.sh
executable file
·53 lines (44 loc) · 1.37 KB
/
deploy-unstable.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
#!/usr/bin/env bash
./fix_version.sh
VERSION=`./get_version.sh`
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m' # No Color
JAR=target/ktApp-${VERSION}.jar
BRANCH=`./get_branch.sh`
BINTRY_URL=https://api.bintray.com/content/gjvnq/misc/OpenICP-BR.unstable/${BRANCH}
if [ "${BINTRAY_PASSWORD}" == "" ]; then
echo -e "${RED}You MUST set the environment variable: BINTRAY_PASSWORD${NC}"
exit -1
fi
if [ ! -f "${JAR}" ]; then
echo -e "${RED}File ${BLUE}${JAR}${RED} does not exist.\n${NC}Please run: mvn clean package${NC}"
exit -1
fi
fail () {
echo -e "${RED}Got error code $? from previous command.${NC}"
exit -1
}
upload() {
FILENAME=$1
SRC=$2
DST=$3
ARGS="-o - -w \\n%{http_code}\\n ${BINTRY_URL}/${DST}/${FILENAME}?publish=1&override=1"
echo curl -T ./${SRC}/${FILENAME} $ARGS
curl -T ./${SRC}/${FILENAME} -ugjvnq:${BINTRAY_PASSWORD} ${ARGS} | tee curl.log
cat curl.log | tail -n 1 | grep -e "2[0-9]\{2\}" > /dev/null || fail
echo -e "${GREEN}Deployed ${DST}/${FILENAME}${NC}"
rm curl.log
}
echo -e "${GREEN}Deploying version: ${BLUE}${VERSION}${NC}..."
# Zip all
cd target
LIBS=`find lib -type f -iname "*.jar"`
ZIP=OpenICP-BR-unstable-${VERSION}.zip
rm $ZIP
cp $(basename ${JAR}) ktApp.jar
zip ${ZIP} ktApp.jar ${LIBS}
echo -e "${GREEN}Generated zip file: ${BLUE}target/${ZIP}${NC}"
# Upload file
upload $ZIP