-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathupload.sh
More file actions
executable file
·55 lines (40 loc) · 1.09 KB
/
upload.sh
File metadata and controls
executable file
·55 lines (40 loc) · 1.09 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
#!/usr/bin/env bash
if [[ $PLATRUM_HOST == "" ]]; then
PLATRUM_HOST=https://app.platrum.ru
fi
if [[ $PLATRUM_API_KEY == "" ]]; then
printf "PLATRUM_API_KEY bash variable should be specified\n"
exit 1
fi
if [[ $PLATRUM_API_PROJECT == "" ]]; then
printf "PLATRUM_API_PROJECT bash variable should be specified\n"
exit 1
fi
if [[ $1 == "" ]]; then
printf "Usage: ./upload.sh {plugin_name}\n"
exit 1
fi
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
PLATRUM_AUTH="key=${PLATRUM_API_KEY}&project=${PLATRUM_API_PROJECT}"
PLUGIN_NAME=plugin-${1}
dir=$(realpath)
printf "\n\n"
set -e
"${dir}/yarn.sh" install
docker run -it --rm \
-v "${dir}/frontend:/app/src" \
-v "${dir}/assets/bundle:/assets" \
-e NODE_ENV=production \
-e HASH_NAMES=0 \
-e PLUGIN_NAME="${PLUGIN_NAME}" \
-w /app \
platrum/builder yarn plugin
printf "\n\n"
zip -r "${PLUGIN_NAME}".zip assets config frontend
printf "\n\n"
curl "${PLATRUM_HOST}/plugins/api/plugin/upload?${PLATRUM_AUTH}" \
-H 'Content-Type: application/json' \
--data-binary "@./${PLUGIN_NAME}.zip"
printf "\n\n"