From 51ba98d058c24632b86b79af5a4ddf6c5ab4e614 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 27 Jul 2022 12:31:40 -0700 Subject: [PATCH] workflows: Fix version check for X.0.0 releases --- .github/workflows/version-check.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/version-check.py b/.github/workflows/version-check.py index 74c061ee9e95..11591312c281 100755 --- a/.github/workflows/version-check.py +++ b/.github/workflows/version-check.py @@ -10,13 +10,21 @@ repo = Repo() tag = repo.git.describe(tags = True, abbrev=0) m = re.match('llvmorg-([0-9]+)\.([0-9]+)\.([0-9]+)', tag) -if not m: - print("error: Tag is not valid: ", tag) - sys.exit(1) -expected_major = m.group(1) -expected_minor = m.group(2) -expected_patch = int(m.group(3)) + 1 +if m: + expected_major = m.group(1) + expected_minor = m.group(2) + expected_patch = int(m.group(3)) + 1 +else: + # If the previous tag is llvmorg-X-init, then we should be at version X.0.0. + m = re.match('llvmorg-([0-9]+)-init', tag) + if not m: + print("error: Tag is not valid: ", tag) + sys.exit(1) + expected_major = m.group(1) + expected_minor = 0 + expected_patch = 0 + expected_version = f"{expected_major}.{expected_minor}.{expected_patch}" m = re.match("[0-9]+\.[0-9]+\.[0-9]+", version)