Skip to content

Commit 2ed3b63

Browse files
committed
[CI/CD] Add support for Docker-specific version strings in version generator script
1 parent 6937e1b commit 2ed3b63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ci/generate_version_number.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_current_branch() -> str:
8989
raise RuntimeError("Could not determine git branch.")
9090

9191

92-
def get_full_version() -> str:
92+
def get_full_version(versionType="") -> str:
9393
"""
9494
Generates and returns the full version string based on Git history.
9595
@@ -128,13 +128,15 @@ def get_full_version() -> str:
128128
short_hash = run_command(["git", "rev-parse", "--short", "HEAD"])
129129
# For feature branches, use the next patch number + commit hash
130130
full_version = f"{version_major_minor}.{int(count_in_master) + 1}+{short_hash}"
131+
if versionType == "docker":
132+
full_version = f"{version_major_minor}.{int(count_in_master) + 1}-{short_hash}"
131133

132134
return full_version
133135

134136
def main():
135137
"""Generates and prints the full version string."""
136138
try:
137-
version = get_full_version()
139+
version = get_full_version(versionType="docker")
138140
print(version)
139141
except (FileNotFoundError, RuntimeError, subprocess.CalledProcessError) as e:
140142
print(f"Error: Could not generate version number.\n{e}", file=sys.stderr)

0 commit comments

Comments
 (0)