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] [tool.semantic_release]
version_toml = ["pyproject.toml:project.version"] version_toml = ["pyproject.toml:project.version"]
branch = "main" 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" build_command = "python -m pip install --upgrade build && python -m build"
dist_path = "dist/" dist_path = "dist/"
upload_to_vcs_release = true upload_to_vcs_release = true

View File

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