-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
49 lines (41 loc) · 1.03 KB
/
deploy.sh
File metadata and controls
49 lines (41 loc) · 1.03 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
#!/bin/bash
file_log=deploy.log
file_fifo=run.fifo
rm -f "$file_log" "$file_fifo"
mkfifo $file_fifo
cat $file_fifo | tee -a $file_log &
exec 3>&1
exec 4>&2
exec 1>$file_fifo
exec 2>&1
gbError="\033[1;31m[ERROR]\033[0m"
gbWarning="\033[1;33m[WARNING]\033[0m"
gbInfo="\033[1;32m[INFO]\033[0m"
gbGood="\033[1;32m[GOOD]\033[0m"
current_time=$(date "+%Y-%m-%d %H:%M:%S")
echo -e "\n <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $current_time >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> \n"
echo -e "$gbInfo Start to build and deploy note...\n"
uames=$(uname -s)
os_name=${uames:0:4}
if [ "$os_name" == "Linu" ]; then # Linux
source /usr/local/nvm/nvm.sh
elif [ "$os_name" == "MING" ]; then # MINGW, windows, git-bash
:
else
exit 1
fi
nvm use 16.15.1
npm install
npm run build
if [ $? -eq 0 ]; then
# forbid SEO
cp robots.txt build/
rm -rf build/sitemap.xml
echo -e "\n$gbGood Successfully built and deployed note!"
else
echo -e "\n$gbError Faild to deploy note, please check it!"
fi
printf "\015"
exec 1>&3
exec 2>&4
rm -f "$file_fifo"