-
Notifications
You must be signed in to change notification settings - Fork 2
/
pub.sh
54 lines (40 loc) · 944 Bytes
/
pub.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
#!/usr/bin/env bash
# 旧版本号
_ov=`npm view mri-cli version`
# 要发布的版本号
_version=""
# git commit 信息
_commit=""
if [ -n ]; then
if [ "$1" == "v" ]; then
_version="$2"
_commit="$4"
elif [ "$1" == "m" ]; then
_version="$4"
_commit="$2"
fi
fi
git pull
git add .
git commit -am "$_commit"
# 若不手动设置版本号,则自动增长
if [ "$_version" == "" ]; then
_version=`npm version patch --no-git-tag-version`
else
npm version $_version --no-git-tag-version
fi
echo "::::: 推送到NPM $_ov -> $_version"
echo ":::::: 推送到NPM"
npm publish
if [ $? -eq 0 ]; then
echo ":::::::::::: Git Mark 此次修改信息"
git pull
git add .
git commit -am "$_ov -> $_version :: $_commit"
git pull
git push
echo "::::::::::::::: Git Tag"
git tag $_version -m "$_ov -> $_version :: $_commit"
git push --tags
fi
###########