chore(deploy): remove version bump helper
This commit is contained in:
@@ -53,48 +53,6 @@ push_to_remote() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# 读取当前版本号(package.json)
|
||||
get_version() {
|
||||
grep '"version":' package.json | head -1 | sed -E 's/.*"version":\s*"([^"]+)".*/\1/'
|
||||
}
|
||||
|
||||
# 递增 build number 并更新 package.json
|
||||
# 返回新的版本号(仅 stdout 输出版本号,日志输出到 stderr)
|
||||
bump_version() {
|
||||
local current=$(get_version)
|
||||
|
||||
if [ -z "$current" ]; then
|
||||
echo "错误: 无法读取当前版本号" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# 解析版本号(格式: x.y.z+build)
|
||||
local build_num=$(echo "$current" | cut -d'+' -f2)
|
||||
local new_build_num=$((build_num + 1))
|
||||
local new_version="${current%%+*}+${new_build_num}"
|
||||
|
||||
# 日志输出到 stderr
|
||||
echo "==========================================" >&2
|
||||
echo "更新版本号..." >&2
|
||||
echo "当前版本: $current" >&2
|
||||
echo "新版本: $new_version" >&2
|
||||
echo "==========================================" >&2
|
||||
|
||||
# 更新 package.json(JSON 格式)
|
||||
sed -i.bak "s/\"version\":\s*\"$current\"/\"version\": \"$new_version\"/" package.json
|
||||
rm -f package.json.bak
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "版本号更新成功: $new_version" >&2
|
||||
else
|
||||
echo "版本号更新失败!" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# 只输出版本号到 stdout
|
||||
echo "$new_version"
|
||||
}
|
||||
|
||||
source_env_file() {
|
||||
local file="$1"
|
||||
if [ ! -f "$file" ]; then
|
||||
|
||||
@@ -12,7 +12,6 @@ source "$SCRIPT_DIR/_deploy_lib.sh"
|
||||
# 主函数
|
||||
main() {
|
||||
push_to_remote "production" "main"
|
||||
# NEW_VERSION=$(bump_version)
|
||||
purge_cdn_cache
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user