-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·46 lines (40 loc) · 915 Bytes
/
deploy.sh
File metadata and controls
executable file
·46 lines (40 loc) · 915 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
44
45
#!/bin/bash
CURRENT_DIR=$(
cd $(dirname $0)
pwd
)
while getopts "m:p" arg; do #选项后面的冒号表示该选项需要参数
case $arg in
m)
# echo "m's arg:$OPTARG" #参数存在$OPTARG中
COMMIT_MSG="$OPTARG"
;;
p)
# echo "-p"
PUSH=1
;;
?) #当有不认识的选项的时候arg为?
echo "unkonw argument"
exit 1
;;
esac
done
echo "--------------------------------------------------"
echo "-m $COMMIT_MSG"
echo "-p $PUSH"
echo "--------------------------------------------------"
echo deploy start
echo "current dir is :" $CURRENT_DIR
$(cd $CURRENT_DIR)
# hugo -d docs
hugo --gc --cleanDestinationDir -d docs --logLevel info
# git status
git add .
git commit -m "[blog] $COMMIT_MSG"
# git status
if [[ $PUSH -eq 1 ]]
then
echo "push to origin master"
git remote -v
git push origin master
fi