UNPKG

1.01 kBapplication/x-shView Raw
1# 1. 获取令牌
2# cat|$1
3
4if [ $# == 0 ];then
5 NPM_TOKEN=`cat NPM_TOKEN`
6else
7 NPM_TOKEN=$1
8fi
9
10
11# 2. 登录 npm 服务器
12# - npm adduser --registry=https://registry.npmjs.org/
13
14npm adduser --registry=https://registry.npmjs.org/ <<!
15blibee
16$NPM_TOKEN
17ye.rong@bianlifeng.com
18!
19
20
21# 3. 获取 npm 上 latest 版本号
22# - npm info bee-ui|grep|awk
23
24latestVersion=`npm info bee-ui|grep 'version:'`
25latestVersion=`echo $latestVersion|awk '{print substr($0,11,length-12)}'`
26
27
28# 4. 本地 package.json 版本号
29# - cat package.json|grep|awk
30
31version=`cat package.json|grep 'version'`
32version=`echo $version|awk '{print substr($0,13,length-14)}'`
33
34
35# 5. 有更新则发布 latest
36# - npm publish
37
38if [ $version != $latestVersion ];then
39 npm publish
40fi
41
42
43# 6. 更新时间戳发布 nightly
44# - sed && npm publish --tag=nightly
45
46timestamp=`date +%Y%m%d%H%M%S`
47nightlyVersion=`echo $version-$timestamp`
48
49sed -i 's/"version": "'$version'"/"version": "'$nightlyVersion'"/g' package.json
50npm publish --tag=nightly