forked from espressif/esp32-arduino-lib-builder
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathrepository_dispatch.sh
executable file
·53 lines (42 loc) · 1.42 KB
/
repository_dispatch.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
#!/bin/bash
if [ ! "$GITHUB_EVENT_NAME" == "repository_dispatch" ]; then
echo "Wrong event '$GITHUB_EVENT_NAME'!"
exit 1
fi
EVENT_JSON=`cat "$GITHUB_EVENT_PATH"`
action=`echo "$EVENT_JSON" | jq -r '.action'`
payload=`echo "$EVENT_JSON" | jq -r '.client_payload'`
branch=`echo "$payload" | jq -r '.branch'`
tag=`echo "$payload" | jq -r '.tag'`
commit=`echo "$payload" | jq -r '.commit'`
builder=`echo "$payload" | jq -r '.builder'`
arduino=`echo "$payload" | jq -r '.arduino'`
echo "Action: $action, IDF Branch: $branch, IDF Tag: $tag, IDF Commit: $commit, Builder Branch: $builder, Arduino Branch: $arduino, Actor: $GITHUB_ACTOR"
if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then
echo "Bad Action $action"
exit 1
fi
export GITHUB_EVENT_ACTION="$action"
if [ ! "$commit" == "" ] && [ ! "$commit" == "null" ]; then
export IDF_COMMIT="$commit"
else
commit=""
if [ ! "$tag" == "" ] && [ ! "$tag" == "null" ]; then
export IDF_TAG="$tag"
elif [ ! "$branch" == "" ] && [ ! "$branch" == "null" ]; then
export IDF_BRANCH="$branch"
fi
fi
if [ ! "$builder" == "" ] && [ ! "$builder" == "null" ]; then
git checkout "$builder"
fi
if [ ! "$arduino" == "" ] && [ ! "$arduino" == "null" ]; then
export AR_BRANCH="$arduino"
fi
if [ "$action" == "deploy" ]; then
DEPLOY_OUT=1
fi
source ./build.sh
# if [ "$action" == "deploy" ]; then
# bash ./tools/push-to-arduino.sh
# fi