-
Notifications
You must be signed in to change notification settings - Fork 7
/
trigger_builds.sh
executable file
·79 lines (63 loc) · 1.35 KB
/
trigger_builds.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
#!/bin/bash
repos=( "biicode/boost-examples-headeronly"
"biicode/boost-examples-log")
while [[ $# > 1 ]]
do
key="$1"
case $key in
--build)
BUILD="$2"
shift
;;
--user)
USER="$2"
shift
;;
--password)
PASSWORD="$2"
shift
;;
--email)
EMAIL="$2"
shift
;;
*)
# unknown option
;;
esac
shift
done
if [ -z "${BUILD}" ]; then
echo ERROR: Missing --build param
exit 1
fi
if [ -z "${USER}" ]; then
echo ERROR: Missing --user param
exit 1
fi
if [ -z "${PASSWORD}" ]; then
echo ERROR: Missing --password param
exit 1
fi
if [ -z "${EMAIL}" ]; then
echo ERROR: Missing --email param
exit 1
fi
commit_id="$(git log --format="%H" -n 1)"
for r in "${repos[@]}"; do
IFS=/ read -a repo <<< "${r}"
repo_account="${repo[0]}"
repo_name="${repo[1]}"
git clone "https://github.com/${r}.git" "${repo_name}"
cd "${repo_name}"
log="biicode/boost build ${BUILD}: ${commit_id}"
echo "${log}" >> ci_builds.txt
git config user.email "${EMAIL}"
git config user.name "${USER}"
git config remote.origin.url "https://${USER}:${PASSWORD}@github.com/${r}.git"
git add ci_builds.txt
git commit -m "${log}"
echo Launching $r build...
git push &>/dev/null # Be careful! git shows "https://USER:[email protected]..." when running push
cd ..
done