Files
proto/script/test_version_script.sh
2025-08-20 22:37:07 +08:00

38 lines
971 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 测试版本号管理脚本
# 设置测试环境
echo "设置测试环境..."
TEST_VERSION="1.0.0"
echo "$TEST_VERSION" > version.txt
# 显示初始版本号
echo "初始版本号: $(cat version.txt)"
# 测试独立脚本
chmod +x get_next_version.sh
# 运行get_next_version.sh脚本
echo -e "\n运行版本号管理脚本..."
NEW_TAG=$(./get_next_version.sh)
# 显示更新后的版本号
echo -e "\n更新后的版本号: $(cat version.txt)"
# 验证版本号是否正确递增
expected_version="1.1.0"
actual_version=$(cat version.txt)
echo -e "\n测试结果"
if [ "$actual_version" = "$expected_version" ]; then
echo "✅ 版本号递增测试通过!"
echo "成功将版本从 $TEST_VERSION 更新到 $actual_version"
echo "生成的git tag: $NEW_TAG"
else
echo "❌ 版本号递增测试失败!"
echo "期望版本: $expected_version, 实际版本: $actual_version"
fi
# 清理测试环境
echo "$TEST_VERSION" > version.txt