-
Notifications
You must be signed in to change notification settings - Fork 52
/
UploadScript.sh
executable file
·53 lines (48 loc) · 985 Bytes
/
UploadScript.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
set -o nounset
set -o errexit
set -o pipefail
declare -r max=4
declare i=0
function wrap() {
echo "Checking whether this build should be uploaded..."
mono_version=$(mono --version | awk '/version/ { print $5 }')
if [ "$TRAVIS_OS_NAME" = "linux" ] ;
then
echo "Linux worker"
split_version=(`echo $mono_version | tr '.' ' '`)
if [ ${split_version[0]} != "5" ] || [ ${split_version[1]} != "20" ] ;
then
echo "Wrong Mono version- Not uploading this build"
exit
else
echo "Mono version OK- Uploading build"
fi
else
echo "Mac worker- Uploading this build"
fi
local cmd=$1 ; shift
retry $cmd "$@"
local success=$?
set -o errexit
exit $success
}
function retry() {
set +o errexit
local cmd=$1 ; shift
$cmd "$@"
s=$?
if [ $s -ne 6 ] ;
then
return $s
elif [ $s -ne 0 -a $i -lt $max ] ;
then
i=$(($i+1))
echo "Retrying"
sleep $((1+$i*$i*5))
retry $cmd "$@";
else
return $s
fi
}
wrap "$@"