From f80c836756ae0f72731e19ba0a44b69a5ff938cf Mon Sep 17 00:00:00 2001 From: Michael Boniface <m.j.boniface@soton.ac.uk> Date: Tue, 11 Mar 2025 15:50:29 +0000 Subject: [PATCH] (fix) versions now increment from tags with a v prefix but then continue without the v, e.g. if v1.2.1 is the latest tag and we increment the major version the next version will be 2.0.0. closes #56 --- acmc/phen.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/acmc/phen.py b/acmc/phen.py index ec675c2..68316f4 100644 --- a/acmc/phen.py +++ b/acmc/phen.py @@ -972,12 +972,14 @@ def _generate_version_tag( # Get all valid semantic version tags versions = [] for tag in repo.tags: - tag_name = ( - tag.name.lstrip("v") if use_v_prefix else tag.name - ) # Remove 'v' if needed + if tag.name.startswith("v"): + tag_name = tag.name[1:] # Remove the first character + else: + tag_name = tag.name if semver.Version.is_valid(tag_name): versions.append(semver.Version.parse(tag_name)) + _logger.debug(f"Versions: {versions}") # Determine the next version if not versions: new_version = semver.Version(0, 0, 1) -- GitLab