chore: 从 git tags 中自动提取版本号

This commit is contained in:
XcantloadX 2025-03-15 17:57:25 +08:00
parent 392c8abf9a
commit 64ae6eea40
3 changed files with 10 additions and 1 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ res/sprites_compiled/
messages/
logs/
traces/
version
##########################
# Byte-compiled / optimized / DLL files

View File

@ -45,6 +45,7 @@ build: env
generate-metadata: env
#!{{shebang_python}}
# 更新日志
from pathlib import Path
with open("WHATS_NEW.md", "r", encoding="utf-8") as f:
content = f.read()
@ -52,6 +53,14 @@ generate-metadata: env
metadata_path.parent.mkdir(parents=True, exist_ok=True)
with open(metadata_path, "w", encoding="utf-8") as f:
f.write(f'WHATS_NEW = """\n{content}\n"""')
# 版本号
from subprocess import check_output
version = check_output(['git', 'describe', '--tags', '--abbrev=0']).decode().strip()
if version.startswith('kaa-v'):
version = version[5:]
with open("version", "w", encoding="utf-8") as f:
f.write(version)
@package-resource:
Write-Host "Packaging kotonebot-resource..."

View File

@ -1 +0,0 @@
2025.3.9.4