feat: improvements to precommit
fix: version
This commit is contained in:
12
.github/workflows/semantic-release.yml
vendored
12
.github/workflows/semantic-release.yml
vendored
@@ -47,6 +47,18 @@ jobs:
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
semantic-release version
|
||||
semantic-release publish
|
||||
|
||||
- name: Sync version to config.py
|
||||
run: |
|
||||
pip install toml
|
||||
python scripts/sync_version.py
|
||||
if git diff --quiet config.py; then
|
||||
echo "No version changes in config.py"
|
||||
else
|
||||
git add config.py
|
||||
git commit -m "chore: sync version to config.py [skip ci]"
|
||||
git push
|
||||
fi
|
||||
|
||||
- name: Upload build artifacts to release
|
||||
if: hashFiles('dist/*') != ''
|
||||
|
||||
@@ -14,9 +14,9 @@ import os
|
||||
# These values are used in server responses and for tracking releases
|
||||
# IMPORTANT: This is the single source of truth for version and author info
|
||||
# Semantic versioning: MAJOR.MINOR.PATCH
|
||||
__version__ = "5.8.5"
|
||||
__version__ = "5.8.6"
|
||||
# Last update date in ISO format
|
||||
__updated__ = "2025-08-08"
|
||||
__updated__ = "2025-08-20"
|
||||
# Primary maintainer
|
||||
__author__ = "Fahad Gilani"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "zen-mcp-server"
|
||||
version = "1.0.0"
|
||||
version = "5.8.6"
|
||||
description = "AI-powered MCP server with multiple model providers"
|
||||
requires-python = ">=3.9"
|
||||
dependencies = [
|
||||
|
||||
45
scripts/sync_version.py
Executable file
45
scripts/sync_version.py
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Sync version from pyproject.toml to config.py
|
||||
This script is called by GitHub Actions after semantic-release updates the version
|
||||
"""
|
||||
|
||||
import re
|
||||
from datetime import datetime
|
||||
import toml
|
||||
|
||||
|
||||
def update_config_version():
|
||||
# Read version from pyproject.toml
|
||||
with open("pyproject.toml", "r") as f:
|
||||
data = toml.load(f)
|
||||
version = data["project"]["version"]
|
||||
|
||||
# Read current config.py
|
||||
with open("config.py", "r") as f:
|
||||
content = f.read()
|
||||
|
||||
# Update version
|
||||
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
|
||||
)
|
||||
|
||||
# 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()
|
||||
Reference in New Issue
Block a user