添加打包配置文件和版本管理系统

This commit is contained in:
huangzhenpc
2025-02-12 09:45:55 +08:00
parent fdc56730bb
commit b531e9052b
4 changed files with 86 additions and 8 deletions

27
update_version.py Normal file
View File

@@ -0,0 +1,27 @@
def increment_version(version_str):
major, minor, patch = map(int, version_str.split('.'))
patch += 1
if patch >= 10:
patch = 0
minor += 1
if minor >= 10:
minor = 0
major += 1
return f"{major}.{minor}.{patch}"
def update_version():
# 读取当前版本
with open('version.txt', 'r', encoding='utf-8') as f:
current_version = f.read().strip()
# 计算新版本
new_version = increment_version(current_version)
# 写入新版本
with open('version.txt', 'w', encoding='utf-8') as f:
f.write(new_version)
print(f"版本号已从 {current_version} 更新到 {new_version}")
if __name__ == '__main__':
update_version()