-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·63 lines (52 loc) · 824 Bytes
/
run.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
#!/bin/sh
BASE="$(cd "$(dirname "$0")" && pwd)"
HUGO=$BASE/bin/hugo
DOCS=../docs
chmod +x $HUGO
cd $BASE
ARGS="-D --config config.yaml"
read1() {
rm -rf $DOCS
git clone https://github.com/starwild/starwild.github.io $DOCS
}
build() {
git submodule update --init --recursive
$HUGO $ARGS -d $DOCS
}
publish() {
git branch --set-upstream-to=origin/main main
pushd $DOCS
git push
popd
}
server() {
$HUGO server $ARGS -p 3000 --bind 0.0.0.0 --baseURL localhost --disableFastRender
}
commit() {
git add .
git commit -m "commit $(date +%Y-%m-%d\ %H:%M:%S)"
git push origin main
}
while getopts ':rbscph' P; do
case $P in
r)
read1
;;
b)
build
;;
s)
server
;;
c)
commit
;;
p)
publish
;;
h)
echo "usage: `basename $0` [options]"
;;
esac
done
shift $(($OPTIND - 1))