-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjpublish.sh
76 lines (62 loc) · 1.25 KB
/
jpublish.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash -x
if [ "$#" -eq "2" ] || [ "$#" -eq "3" ]; then
echo "run: `basename $0` $*"
echo $#
else
echo "Usage: `basename $0` rtm-aar 1.0.0 [bintray key]"
exit 1
fi
product=$1
sdk_version=$2
echo $0
if [ "$#" -eq "3" ]; then
export BINTRAY_KEY=$3
fi
export PUBLISH_SDK_VERSION=${sdk_version}
echo product: $1, sdk_version: $2
echo $PUBLISH_SDK_VERSION
#source ~/.bash_profile
# ----------- #
# function #
# ----------- #
die() {
echo
echo "$*"
echo
exit 1
}
echo_stdout() {
while IFS='' read -r line || [[ -n "$line" ]]; do
echo ${line}
done < release.log
}
echo_run() {
echo
echo "$*"
echo "$*" >> release.log
`$* >> release.log`
echo
echo_stdout
grep 'FAILED' release.log
# if [ ! -n $(grep 'FAILED' release.log) ]; then
# die "catch failure!"
# fi
}
# -------- #
# build #
# -------- #
# clear log file
if [ -e release.log ]; then
echo_run rm -f release.log
fi
echo_run ./gradlew ${product}:clean
echo_run ./gradlew ${product}:assembleRelease
# -------- #
# upload #
# -------- #
echo_run ./gradlew ${product}:bintrayUpload -PbintrayUser=agora -PbintrayKey=${BINTRAY_KEY} -PdryRun=false
# -------- #
# teardown #
# -------- #
#git clean -xdf
exit 0