fix: establish version 5.8.6 and add version sync automation

- Set version to 5.8.6 in pyproject.toml to match config.py
- Add automatic version sync script for GitHub Actions
- Configure semantic-release for proper version tracking
- Ensure __updated__ field auto-updates with each release
This commit is contained in:
Fahad
2025-08-20 16:25:43 +04:00
parent 4f82f65005
commit 90a4195381
2 changed files with 14 additions and 18 deletions

View File

@@ -87,6 +87,9 @@ ignore = [
[tool.semantic_release]
version_toml = ["pyproject.toml:project.version"]
branch = "main"
version_source = "tag"
version_pattern = "v(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)"
major_on_zero = false
build_command = "python -m pip install --upgrade build && python -m build"
dist_path = "dist/"
upload_to_vcs_release = true

View File

@@ -6,40 +6,33 @@ This script is called by GitHub Actions after semantic-release updates the versi
import re
from datetime import datetime
import toml
def update_config_version():
# Read version from pyproject.toml
with open("pyproject.toml", "r") as f:
with open("pyproject.toml") as f:
data = toml.load(f)
version = data["project"]["version"]
# Read current config.py
with open("config.py", "r") as f:
with open("config.py") as f:
content = f.read()
# Update version
content = re.sub(
r'__version__ = "[^"]*"',
f'__version__ = "{version}"',
content
)
content = re.sub(r'__version__ = "[^"]*"', f'__version__ = "{version}"', content)
# Update date to current date
today = datetime.now().strftime("%Y-%m-%d")
content = re.sub(
r'__updated__ = "[^"]*"',
f'__updated__ = "{today}"',
content
)
content = re.sub(r'__updated__ = "[^"]*"', f'__updated__ = "{today}"', content)
# Write back
with open("config.py", "w") as f:
f.write(content)
print(f"Updated config.py to version {version}")
if __name__ == "__main__":
update_config_version()
update_config_version()