Skip to content

Commit 252a0da

Browse files
committed
add publish.sh to publish to nginx
Signed-off-by: Sky Ao <[email protected]>
1 parent 71b82f0 commit 252a0da

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

publish.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
workPath=$(dirname $0)
3+
cd $workPath
4+
echo "work path is $workPath"
5+
workPath=$(pwd)
6+
echo "change work path to abstract $workPath"
7+
echo "cd $workPath"
8+
cd $workPath
9+
10+
# update to latest code
11+
git pull
12+
echo "Update by git pull"
13+
14+
echo "Start to build $targetProject ..."
15+
rm -rf public
16+
env HUGO_ENV="production" hugo121 --baseURL="https://cloudruntime.net/docs/"
17+
if [ $? -ne 0 ]; then
18+
echo "Fail to build html content by hugo, exit"
19+
exit 1
20+
fi
21+
echo "Success to build cloudruntime user documentation"
22+
23+
publishPath="/var/www/cloudruntime/docs/"
24+
echo "Start to publish cloudruntime site ..."
25+
mkdir -p $publishPath
26+
cd $publishPath
27+
rm -rf $publishPath/*
28+
if [ $? -ne 0 ]; then
29+
echo "Fail to remove files in $publishPath, exit"
30+
exit 1
31+
fi
32+
33+
cd $workPath
34+
cd public
35+
cp -r * $publishPath
36+
if [ $? -ne 0 ]; then
37+
echo "Fail to copy files to $publishPath, exit"
38+
exit 1
39+
fi
40+
echo "Suceess to publish cloudruntime user documentation to $publishPath"
41+
echo "Done"

0 commit comments

Comments
 (0)