forked from rrd108/vue-mess-detector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-docs.sh
executable file
·47 lines (39 loc) · 1.17 KB
/
deploy-docs.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
#!/bin/bash
RED='\e[1;41m'
GREEN='\e[1;42m'
NC='\033[0m' # No Color
SSH_USER=$1
SSH_HOST=$2
SSH_PATH='./web/'
if ! echo "$SSH_USER" | grep -q "bma"; then
echo -e "${RED}The SSH_USER seems to be different then the required${NC}"
exit 1
fi
echo $'\n' "Checking missing docs" $'\n'
yarn docs:missing
PREV_STEP=1
if [ $PREV_STEP -eq 1 ];then
echo $'\n' "Run docs:build to generate docs:dist files" $'\n'
yarn docs:build
if [ $? -eq 0 ]; then
echo -e $'\n' "${GREEN} \u2714 Docs generated ${NC}" $'\n'
PREV_STEP=1
else
echo -e $'\n' "${RED} \u2a2f Docs generation failed ${NC}" $'\n'
PREV_STEP=0
fi
fi
if [ $PREV_STEP -eq 1 ];then
echo $'\n' "Copy docs:dist folder to server" $'\n'
rsync --progress -azh \
--delete --exclude='error/' --exclude='stats/' --exclude='.htaccess' --exclude='robots.txt' \
./docs/.vitepress/dist/ \
-e "ssh -i /home/rrd/.ssh/vmd_webmania" \
$SSH_USER@$SSH_HOST:$SSH_PATH
if [ $? -eq 0 ]; then
echo -e $'\n' "${GREEN} \u2714 docs:dist folder uploaded ${NC}" $'\n'
else
echo -e $'\n' "${RED} \u2a2f docs:dist folder upload failed ${NC}" $'\n'
PREV_STEP=0
fi
fi