|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
3 |
| -if [ ! $GITHUB_EVENT_NAME == "repository_dispatch" ]; then |
| 3 | +if [ ! "$GITHUB_EVENT_NAME" == "repository_dispatch" ]; then |
4 | 4 | echo "Wrong event '$GITHUB_EVENT_NAME'!"
|
5 | 5 | exit 1
|
6 | 6 | fi
|
7 | 7 |
|
8 |
| -#echo "Event: $GITHUB_EVENT_NAME, Repo: $GITHUB_REPOSITORY, Path: $GITHUB_WORKSPACE, Ref: $GITHUB_REF" |
| 8 | +EVENT_JSON=`cat "$GITHUB_EVENT_PATH"` |
| 9 | +action=`echo "$EVENT_JSON" | jq -r '.action'` |
| 10 | +payload=`echo "$EVENT_JSON" | jq -r '.client_payload'` |
| 11 | +branch=`echo "$payload" | jq -r '.branch'` |
| 12 | +commit=`echo "$payload" | jq -r '.commit'` |
| 13 | +builder=`echo "$payload" | jq -r '.builder'` |
9 | 14 |
|
10 |
| -EVENT_JSON=`cat $GITHUB_EVENT_PATH` |
11 |
| -action=`echo $EVENT_JSON | jq -r '.action'` |
12 |
| -payload=`echo $EVENT_JSON | jq -r '.client_payload'` |
13 |
| -branch=`echo $payload | jq -r '.branch'` |
14 |
| -commit=`echo $payload | jq -r '.commit'` |
| 15 | +echo "Action: $action, Branch: $branch, Commit: $commit, Builder: $builder" |
15 | 16 |
|
16 |
| -echo "Action: $action, Branch: $branch, Commit: $commit" |
17 |
| - |
18 |
| -if [ ! $action == "deploy" ] && [ ! $action == "build" ]; then |
| 17 | +if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then |
19 | 18 | echo "Bad Action $action"
|
20 | 19 | exit 1
|
21 | 20 | fi
|
22 | 21 |
|
23 | 22 | export GITHUB_EVENT_ACTION="$action"
|
24 | 23 |
|
25 |
| -if [ ! $commit == "" ] && [ ! $commit == "null" ]; then |
| 24 | +if [ ! "$commit" == "" ] && [ ! "$commit" == "null" ]; then |
26 | 25 | export IDF_COMMIT="$commit"
|
27 | 26 | else
|
28 |
| - commit="" |
29 |
| - if [ ! $branch == "" ] && [ ! $branch == "null" ]; then |
30 |
| - export IDF_BRANCH="$branch" |
31 |
| - git checkout "$IDF_BRANCH" #local branches should match what the matrix wants to build |
32 |
| - fi |
| 27 | + commit="" |
| 28 | + if [ ! "$branch" == "" ] && [ ! "$branch" == "null" ]; then |
| 29 | + export IDF_BRANCH="$branch" |
| 30 | + fi |
33 | 31 | fi
|
34 | 32 |
|
35 |
| -source ./build.sh |
| 33 | +if [ ! "$builder" == "" ] && [ ! "$builder" == "null" ]; then |
| 34 | + git checkout "$builder" |
| 35 | +fi |
36 | 36 |
|
37 |
| -#bash ./tools/archive-build.sh |
| 37 | +source ./build.sh |
38 | 38 |
|
39 |
| -if [ $action == "deploy" ]; then |
40 |
| - bash ./tools/push-to-arduino.sh $commit |
| 39 | +if [ "$action" == "deploy" ]; then |
| 40 | + bash ./tools/push-to-arduino.sh |
41 | 41 | fi
|
0 commit comments