-
Notifications
You must be signed in to change notification settings - Fork 39
/
pre-release.sh
executable file
·42 lines (35 loc) · 1.19 KB
/
pre-release.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
#!/bin/bash
# 版本发布前的脚本,设置版本号,更新打包资源,更新相关依赖
# Usage: pre-release.sh [version]
# 出错时终止执行
set -e
# 读取版本号
if [ -z "$1" ]; then
echo "Usage: pre-release.sh [version]"
echo "Example: pre-release.sh v1.0.0"
exit 1
fi
version=$1
# 替换版本号 cool-tools/internal/cmd/version.go 中的 binVersion = "xxxx"
if [ "$(uname)" == "Darwin" ]; then
sed -i '' -e "s/binVersion := \".*\"/binVersion := \"$version\"/g" cool-tools/internal/cmd/version.go
else
sed -i -e "s/binVersion := \".*\"/binVersion := \"$version\"/g" cool-tools/internal/cmd/version.go
fi
# sed -i '' "s/binVersion := \".*\"/binVersion := \"$version\"/g" cool-tools/internal/cmd/version.go
# 进入脚本所在目录
cd "$(dirname "$0")"
# 发布文档
yarn docs:deploy
# 进入cool-tools目录
cd cool-tools
# 如果当前环境为github codespace, 则使用https方式拉取, 否则使用ssh方式拉取
if [ -n "$CODESPACES" ]; then
echo "github codespace detected, using https to pull"
make pack.template-simple
make pack.docs
else
echo "github codespace not detected, use ssh"
make pack.template-simple.ssh
make pack.docs.ssh
fi