feat: ci.

This commit is contained in:
yassun7010 2024-11-24 20:37:18 +09:00
parent 1f5e60a890
commit df86885867
2 changed files with 26 additions and 0 deletions

16
python/set_version.py Normal file
View file

@ -0,0 +1,16 @@
import os
from pathlib import Path
project_root = Path(__file__).parents[1].absolute()
pyproject_toml_path = project_root / "pyproject.toml"
with open(pyproject_toml_path, "r") as f:
contents = f.read()
with open(pyproject_toml_path, "w") as f:
if (github_ref := os.getenv("GITHUB_REF")) and github_ref.startswith("refs/tags/"):
version = github_ref.replace("refs/tags/v", "")
contents = contents.replace('version = "0.0.0"', f'version = "{version}"')
f.write(contents)