-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdk-setup
executable file
·33 lines (24 loc) · 1.17 KB
/
gdk-setup
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
#!/usr/bin/env bash
COMPONENT_PATH=$1
SCRIPT_PATH=$(dirname -- "${BASH_SOURCE[0]}") || {
echo >&2 "Could not find the script directory. Exiting."
exit 1
}
. "$SCRIPT_PATH"/shared.sh
validate_component "$COMPONENT_PATH"
if [ ! -f "gdk-config.json.template" ]; then
echo "No gdk-config.json.template. Using gdk-config.json without changes."
exit 0
fi
set -e
cp gdk-config.json.template gdk-config.json.temp
# Set the author
jq -r '.component.temp = (.component | keys | .[0]) | .component[.component.temp].author = "BlogReader" | del(.component.temp)' gdk-config.json.temp >gdk-config.json.temp1
mv gdk-config.json.temp1 gdk-config.json.temp
# Set the bucket prefix
jq -r '.component.temp = (.component | keys | .[0]) | .component[.component.temp].publish.bucket = "'"$S3_BUCKET_PREFIX"'" | del(.component.temp)' gdk-config.json.temp >gdk-config.json.temp1
mv gdk-config.json.temp1 gdk-config.json.temp
# Set the region
jq -r '.component.temp = (.component | keys | .[0]) | .component[.component.temp].publish.region = "'"$REGION"'" | del(.component.temp)' gdk-config.json.temp >gdk-config.json.temp1
mv gdk-config.json.temp1 gdk-config.json.temp
mv gdk-config.json.temp gdk-config.json