-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-deploy.sh
executable file
·48 lines (42 loc) · 1.04 KB
/
build-deploy.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
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")" || exit
if ! command -v trunk &>/dev/null; then
echo "[ERROR] Trunk must be installed (https://trunkrs.dev/#install)"
exit 1
fi
if [[ "$1" == "" ]]; then
echo "[ERROR] Missing argument 1 'rsync target'"
exit 1
fi
if pgrep trunk >/dev/null; then
echo "*"
echo "*"
echo "[WARN] A running trunk program was detected. This may lead to unexpected side effects"
echo "*"
echo "*"
echo
fi
echo "[TASK] Build the catalog"
cargo run --bin chordr -- build-catalog webchordr/app/static/songs webchordr/app/static/catalog.json
echo "[TASK] Create deploy-build"
pushd webchordr/app || exit 1
if [[ $* == *--dev* ]]; then
if [[ $* == *--verbose* ]]; then
trunk -v build
else
trunk build
fi
else
if [[ $* == *--verbose* ]]; then
trunk -v build --release
else
trunk build --release
fi
fi
if [[ $* == *--verbose* ]] && type twiggy &>/dev/null; then
twiggy top -n 10 ./dist/*.wasm
fi
popd >/dev/null
echo "[TASK] Upload to $1"
rsync -i --exclude '*.scss' -rzu webchordr/app/dist/ $1