添加打包配置文件和版本管理系统
This commit is contained in:
27
update_version.py
Normal file
27
update_version.py
Normal 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()
|
||||
Reference in New Issue
Block a user