refactor: 将版本号注入移至构建配置
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""更新版本号脚本"""
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -20,22 +19,6 @@ def increment_version(version: str) -> str:
|
||||
return version
|
||||
|
||||
|
||||
def update_index_html(version: str):
|
||||
"""更新 webui/index.html 中的标题版本号"""
|
||||
index_file = Path(__file__).parent / "webui" / "index.html"
|
||||
content = index_file.read_text(encoding="utf-8")
|
||||
|
||||
# 替换标题中的版本号
|
||||
new_content = re.sub(
|
||||
r"<title>EGM 输电线路绕击跳闸率计算( v[\d.]+)?</title>",
|
||||
f"<title>EGM 输电线路绕击跳闸率计算 v{version}</title>",
|
||||
content
|
||||
)
|
||||
|
||||
index_file.write_text(new_content, encoding="utf-8")
|
||||
print(f"Updated version in {index_file} to v{version}")
|
||||
|
||||
|
||||
def update_version_file(version: str):
|
||||
"""更新 VERSION 文件"""
|
||||
version_file = Path(__file__).parent / "VERSION"
|
||||
@@ -66,7 +49,6 @@ def main():
|
||||
|
||||
# 更新所有文件
|
||||
update_version_file(new_version)
|
||||
update_index_html(new_version)
|
||||
create_metadata(new_version)
|
||||
|
||||
print(f"Version updated: {current_version} -> {new_version}")
|
||||
|
||||
Reference in New Issue
Block a user