-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.sh
executable file
·76 lines (47 loc) · 1.35 KB
/
deploy.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
baidu_verify=baidu_verify_code-dsg13vHGjF.html
url_txt=urls.txt
doCommit() {
git checkout mkdocs
rm -rf site
mkdocs build
echo ">>>>>>> copying CNAME & README.md"
cp README.md site/
# cp CNAME site/
cp $baidu_verify site/
echo ">>>>>>> build in mkdocs branch success"
echo "push2baidu executing ..."
rm -f $url_txt
cmd=`grep loc site/sitemap.xml | awk -F ">" '{print $2}' | awk -F "<" '{print $1}'`
for line in $cmd; do
echo $line >> $url_txt
done
echo "pushing urls to baidu"
curl -H 'Content-Type:text/plain' --data-binary "@$url_txt" "http://data.zz.baidu.com/urls?site=https://wzasd.github.io&token=gv0ua2vUtIH0z7bt"
echo "push completed."
rm -f $url_txt
git checkout master
rm -rf docs/ mkdocs.yml serve.sh push2baidu.sh
echo ">>>>>>> copy site to root .."
cp -a site/* .
echo ">>>>>>> copy site to root success"
git add .
echo ">>>>>>> ready commit in master"
echo ">>>>>>> exec git status ."
git status .
echo ">>>>>>> exec commit"
git commit -m 'deploy from mkdocs'
git push -f
git checkout mkdocs
rm -rf site/
}
read -r -p "Are you sure to deploy? [Y/N] " input
case $input in
[Yy][Ee][Ss]|[Yy])
doCommit
;;
[Nn][Oo]|[Nn])
;;
*)
;;
esac