-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
.build.sh
94 lines (73 loc) · 1.57 KB
/
.build.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
set -x
set -e
SONATYPE_SECRET=.secrets/credentials.sonatype-nexus.properties
function csbt {
COMMAND="time sbt -batch -no-colors -v $*"
eval $COMMAND
}
function build {
csbt +clean +test
}
function scripted {
csbt clean publishLocal sbt-tests/scripted || exit 1
}
function publish {
#copypaste
if [[ "$CI_PULL_REQUEST" != "false" ]] ; then
return 0
fi
if [[ ! -f "$SONATYPE_SECRET" ]] ; then
return 0
fi
if [[ ! ("$CI_BRANCH" == "develop" || "$CI_BRANCH_TAG" =~ ^v.*$ ) ]] ; then
return 0
fi
echo "PUBLISH SCALA LIBRARIES..."
if [[ "$CI_BRANCH" == "develop" ]] ; then
csbt +clean +package +publishSigned
else
csbt +clean +package +publishSigned sonatypeBundleRelease
fi
}
function init {
export SCALA212=$(cat projects/ScalaVersions.scala | grep 'scala_212' | sed -r 's/.*\"(.*)\".**/\1/')
export SCALA213=$(cat projects/ScalaVersions.scala | grep 'scala_213' | sed -r 's/.*\"(.*)\".**/\1/')
printenv
}
function secrets {
mkdir .secrets
if [[ "$CI_PULL_REQUEST" == "false" ]] ; then
echo "$SONATYPE_CREDENTIALS_FILE" > "$SONATYPE_SECRET"
openssl aes-256-cbc -K "$OPENSSL_KEY" -iv "$OPENSSL_IV" -in secrets.tar.enc -out secrets.tar -d
tar xvf secrets.tar
fi
}
init
PARAMS=()
SOFT=0
SKIP=()
for i in "$@"
do
case $i in
nothing)
echo "Doing nothing..."
;;
build)
build
;;
scripted)
scripted
;;
publish)
publish
;;
secrets)
secrets
;;
*)
echo "Unknown option"
exit 1
;;
esac
done