Skip to content

Commit 944e7cb

Browse files
committed
Add version check task
1 parent e83982a commit 944e7cb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tasks.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77

8+
89
@task
910
def test(c: Context) -> None:
1011
"""
@@ -49,6 +50,33 @@ def test(c: Context) -> None:
4950
print(stderr_output)
5051

5152

53+
@task
54+
def check_version(c: Context) -> None:
55+
"""Validate that ``pyproject.toml`` matches the latest git tag.
56+
57+
This task runs the ``scripts/check_version_match.py`` helper using Poetry
58+
and reports whether the version numbers are aligned.
59+
60+
Args:
61+
c: Invoke context used to run shell commands.
62+
63+
Returns:
64+
None
65+
"""
66+
if not isinstance(c, Context):
67+
raise TypeError(f"Expected Invoke Context, got {type(c).__name__!r}")
68+
69+
# Execute the version check script with Poetry.
70+
cmd = "poetry run python scripts/check_version_match.py"
71+
result = c.run(cmd, warn=True, pty=False)
72+
73+
# Report based on the exit code from the script.
74+
if result.ok:
75+
print("✔️ pyproject version matches the latest git tag.")
76+
else:
77+
print("❌ Version mismatch detected.")
78+
print(result.stderr)
79+
5280
@task
5381
def docs(c: Context) -> None:
5482
"""

0 commit comments

Comments
 (0)