-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild-bootstrap.sh
40 lines (34 loc) · 1.41 KB
/
build-bootstrap.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
#!/usr/bin/env bash
JENKINS_ANDROID_JOB="$JENKINS_URL/job/android/buildWithParameters?token=$JENKINS_BUILD_TOKEN&PUBLISH_BUILD=${PUBLISH_BUILD:-false}"
WEEK_DAY=$(date +%u) # day of the week (1..7); 1 is Monday
MONTH_DAY=$(date +%d) # day of the month; (01..NN)
curl -s https://raw.githubusercontent.com/Unlegacy-Android/build_config/master/build-targets > build-targets
function process_line {
LINE=$1
if [ "$LINE" != "" ] && [[ $LINE != \#* ]] ;
then
IFS=' '
declare -a LINE_ARRAY=($*)
DEVICE=${LINE_ARRAY[0]}
BUILD_TYPE=${LINE_ARRAY[1]}
BRANCH=${LINE_ARRAY[2]}
FREQ=${LINE_ARRAY[3]}
BUILD_DAY=${LINE_ARRAY[4]}
if [ $FORCE_BUILD == "true" ] ; then
if [ "$SPECIFIED_BRANCH" == "$BRANCH" ] ; then
curl $JENKINS_ANDROID_JOB\&BRANCH=$BRANCH\&DEVICE=$DEVICE\&BUILD_TYPE=$BUILD_TYPE
fi
elif [ "$FREQ" == "" ] || [ "$FREQ" == "D" ] ; then
curl $JENKINS_ANDROID_JOB\&BRANCH=$BRANCH\&DEVICE=$DEVICE\&BUILD_TYPE=$BUILD_TYPE
elif [ "$FREQ" == "W" ] && [ "$WEEK_DAY" == "$BUILD_DAY" ] ; then
curl $JENKINS_ANDROID_JOB\&BRANCH=$BRANCH\&DEVICE=$DEVICE\&BUILD_TYPE=$BUILD_TYPE
elif [ "$FREQ" == "M" ] && [ "$MONTH_DAY" == "$BUILD_DAY" ] ; then
curl $JENKINS_ANDROID_JOB\&BRANCH=$BRANCH\&DEVICE=$DEVICE\&BUILD_TYPE=$BUILD_TYPE
fi
fi
}
while read i;
do
process_line "$i";
sleep 1
done < ./build-targets