chore: script bump_version.py — plus jamais oublier de bumper
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Bump FlowDeck version and create a git tag."""
|
||||
import re, sys, subprocess
|
||||
|
||||
MAIN_FILE = "app/main.py"
|
||||
|
||||
with open(MAIN_FILE) as f:
|
||||
content = f.read()
|
||||
|
||||
current = re.search(r'version="(\d+\.\d+\.\d+)"', content)
|
||||
if not current:
|
||||
print("Version not found in", MAIN_FILE)
|
||||
sys.exit(1)
|
||||
|
||||
old_ver = current.group(1)
|
||||
parts = old_ver.split(".")
|
||||
if len(sys.argv) > 1:
|
||||
new_ver = sys.argv[1]
|
||||
else:
|
||||
parts[-1] = str(int(parts[-1]) + 1)
|
||||
new_ver = ".".join(parts)
|
||||
|
||||
new_content = content.replace(f'version="{old_ver}"', f'version="{new_ver}"')
|
||||
with open(MAIN_FILE, "w") as f:
|
||||
f.write(new_content)
|
||||
|
||||
subprocess.run(["git", "add", MAIN_FILE])
|
||||
print(f"Bumped {old_ver} → {new_ver}")
|
||||
print("Run: git commit -m 'chore: bump version {old_ver} → {new_ver}'")
|
||||
print(f"And: git tag v{new_ver}")
|
||||
Reference in New Issue
Block a user