forked from DiscoverForever/monaco-sqlpad
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnpm-publish.sh
More file actions
45 lines (31 loc) · 1.07 KB
/
npm-publish.sh
File metadata and controls
45 lines (31 loc) · 1.07 KB
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
#!/usr/bin/env bash
echo "\033[0;32m?\033[0m \033[36m请输入你的新发布的版本号(ex:1.0.0):\033[0m"
read version
# 处理 package.json
sed -i -e "s/\"version\": \(.*\)/\"version\": \"$version\",/g" 'package.json'
if [ -f "package.json-e" ];then
rm 'package.json-e'
fi
echo '\033[36m版本号修改成功\033[0m'
npm config get registry # 检查仓库镜像库
npm config set registry=http://registry.npmjs.org # 设置仓库镜像库: 淘宝镜像https://registry.npm.taobao.org
echo '\033[36m请进行登录相关操作:\033[0m'
npm login # 登陆
echo "-------\033[36mpublishing\033[0m-------"
rm -rf dist # 删除dist历史文件
npm run build # 打包
npm publish # 发布
echo "\033[36m 发布完成 \033[0m"
time=$(date "+%Y%m%d%H%M%S")
tag_name="$time-v$version"
echo "git add package.json"
git add package.json
echo "git commit -m Mod update version $version"
git commit -m "Mod update version $version"
echo "git push"
git push
echo "生成发布tag $tag_name"
git tag "$tag_name"
echo "推送tag $tag_name 到远程仓库"
git push origin $tag_name
exit