forked from wxpusher/wxpusher-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-docs.sh
More file actions
43 lines (35 loc) · 888 Bytes
/
deploy-docs.sh
File metadata and controls
43 lines (35 loc) · 888 Bytes
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
if [[ $1 == "-p" ]]; then
deployPath=/data/wxpusher/wxpusher-docs/docs/
server=139.198.188.161
port=20122
echo "部署生成环境"
else
deployPath=/data/app/wxpusher-test/wxpusher-docs/docs/
server=115.28.141.240
port=22
echo "部署测试环境"
fi
targetFile=dist.tar.gz
echo "打包产物"
tar -zcf ${targetFile} -C docs .
echo "上传"
ssh -p ${port} admin@${server} "
if [ ! -d ${deployPath} ]; then
echo "文件夹不存在,创建文件夹"
mkdir -p ${deployPath}
fi
"
echo "上传文件:${targetFile}"
scp -P ${port} ${targetFile} admin@${server}:${deployPath}${targetFile}
echo "上传完成"
echo "解压"
ssh -p ${port} admin@${server} "
tar -zxf ${deployPath}${targetFile} -C ${deployPath}
rm ${deployPath}${targetFile}
"
rm ${targetFile}
if [[ $? == 0 ]]; then
echo "\033[32m 部署完成"
else
echo "\033[31m 部署失败"
fi