Skip to content

Commit 94c9805

Browse files
committed
Add first version templating concept
1 parent 0f22bd6 commit 94c9805

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

backend/flakestry/api/publish.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,17 @@ def publish(
7575
commit_date = commit_json["commit"]["committer"]["date"]
7676

7777
# Validate & parse version
78+
datetime = re.sub(r"[^0-9]", "", commit_date)
7879
if publish.version:
79-
given_version = publish.version
80+
given_version = publish.version.format(
81+
datetime=datetime,
82+
date=datetime[:8],
83+
time=datetime[8:],
84+
)
8085
elif publish.ref and publish.ref.startswith("refs/tags/"):
8186
given_version = publish.ref.removeprefix("refs/tags/")
8287
else:
83-
given_version = f"v0.1.{re.sub(r'[^0-9]', '', commit_date)}"
88+
given_version = f"v0.1.{datetime}"
8489

8590
version_regex = r"^v?([0-9]+\.[0-9]+\.?[0-9]*$)"
8691
version = re.search(version_regex, given_version)

0 commit comments

Comments
 (0)