-
Notifications
You must be signed in to change notification settings - Fork 1
/
release
executable file
·54 lines (45 loc) · 1012 Bytes
/
release
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
#!/bin/bash
while getopts "d:p:" arg #选项后面的冒号表示该选项需要参数
do
case $arg in
d)
# echo "d's arg:$OPTARG" #参数存在$OPTARG中
dist=$OPTARG
;;
p)
path=$OPTARG
;;
?) #当有不认识的选项的时候arg为?
echo "未知参数"
exit 1
;;
esac
done
git fetch origin
git checkout master
git diff master origin/master
for ((;;))
do
echo '请确保更新内容是否可被发布.'
echo -n '你确定要拉取并发布 origin/master 分支的内容吗? (y/n) '
read result
if [[ "$result" == [yY] ]]
then
break
elif [[ "$result" == [nN] ]]
then
exit
fi
done
if [[ "$dist" == "" ]]
then
dist='./dist'
fi
if [[ "$path" == "" ]]
then
path='http://m.qmin91.com/'
fi
echo '正在拉取 origin/master...'
git pull || exit
echo '发布中...'
NODE_ENV=production node build/webpack.production.js $dist $path