-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·72 lines (65 loc) · 1.77 KB
/
publish.sh
File metadata and controls
executable file
·72 lines (65 loc) · 1.77 KB
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
#! /bin/bash
exit_on_error() {
if [[ $exit_code -ne 0 ]]; then
>&2 echo "command failed with exit code $1."
exit $exit_code
fi
echo "successful"
}
PACKAGE_PATH="$1"
shift
INSTALL_HUB_ID=0
PROD_CHANNEL_ID="2076fb52-0ef5-4db9-aa7d-34fb6de0b6a8"
BETA_CHANNEL_ID="b9930d5a-f3f5-4428-b378-b12cb3d93093"
if test -f "ids_env"; then
source "ids_env"
fi
CHANNEL_ID=$PROD_CHANNEL_ID
parse_args() {
while [ $# -gt 0 ]; do
local key="$1"
echo "$key"
case "$key" in
--install)
case $2 in
personal)
INSTALL_HUB_ID=$PERSONAL_HUB_ID
;;
v3)
INSTALL_HUB_ID=$PROD_V3_HUB_ID
;;
v2)
INSTALL_HUB_ID=$PROD_V2_HUB_ID
;;
pc)
INSTALL_HUB_ID=$PROD_PC_HUB_ID
;;
*)
INSTALL_HUB_ID="$2"
;;
esac
shift
;;
--beta)
CHANNEL_ID=$BETA_CHANNEL_ID
;;
*)
;;
esac
shift
done
}
parse_args $@
echo "packaging $PACKAGE_PATH"
PACKAGE_JSON="$(st edge:drivers:package $PACKAGE_PATH --json)"
echo $?
exit_on_error $?
ID="$(echo "$PACKAGE_JSON" | jq -r ".driverId")"
echo "publishing $ID to $CHANNEL_ID"
st edge:drivers:publish $ID -C $CHANNEL_ID
exit_on_error $? "$(echo "!:0")" "!:*"
if [ ! -z "$INSTALL_HUB_ID" ]; then
echo "Installing $ID $INSTALL_HUB_ID $CHANNEL_ID"
st edge:drivers:install "$ID" -H="$INSTALL_HUB_ID" -C="$CHANNEL_ID"
exit_on_error $? "!:0" "!:*"
fi