mirror of
https://github.com/tombi-toml/tombi.git
synced 2025-12-23 09:19:21 +00:00
feat: ci.
This commit is contained in:
parent
1f5e60a890
commit
df86885867
2 changed files with 26 additions and 0 deletions
16
python/set_version.py
Normal file
16
python/set_version.py
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue