-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·40 lines (36 loc) · 949 Bytes
/
publish.sh
File metadata and controls
executable file
·40 lines (36 loc) · 949 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
#!/bin/bash
workPath=$(dirname $0)
cd $workPath
echo "work path is $workPath"
workPath=$(pwd)
echo "change work path to abstract $workPath"
echo "cd $workPath"
cd $workPath
# update to latest code
git pull
echo "Update by git pull"
echo "Start to build $targetProject ..."
rm -rf public
env HUGO_ENV="production" hugo121 --baseURL="http://cloudruntime.net/"
if [ $? -ne 0 ]; then
echo "Fail to build html content by hugo, exit"
exit 1
fi
echo "Success to build cloudruntime site"
publishPath="/var/www/cloudruntime/"
echo "Start to publish cloudruntime site ..."
cd $publishPath
ls $publishPath | grep -v docs | grep -v devdocs | xargs rm -rf
if [ $? -ne 0 ]; then
echo "Fail to remove files in $publishPath, exit"
exit 1
fi
cd $workPath
cd public
cp -r * $publishPath
if [ $? -ne 0 ]; then
echo "Fail to copy files to $publishPath, exit"
exit 1
fi
echo "Suceess to publish cloudruntime site to $publishPath"
echo "Done"