diff --git a/ci/version_check.py b/ci/version_check.py index 6f0529c40c..53bec2638d 100644 --- a/ci/version_check.py +++ b/ci/version_check.py @@ -87,8 +87,16 @@ if __name__ == '__main__': # GITHUB_REF may be either 'refs/heads/' or 'refs/heads/' GITHUB_REF = os.environ['GITHUB_REF'] + GITHUB_REF_NAME = os.environ['GITHUB_REF_NAME'] + GITHUB_BASE_REF = os.environ['GITHUB_BASE_REF'] + # Print out version information, makes debugging actions *much* easier! + print(f"GITHUB_REF: {GITHUB_REF}") + print(f"GITHUB_REF_NAME: {GITHUB_REF_NAME}") + print(f"GITHUB_REF_TYPE: {GITHUB_REF_TYPE}") + print(f"GITHUB_BASE_REF: {GITHUB_BASE_REF}") + version_file = os.path.join(here, '..', 'InvenTree', 'InvenTree', 'version.py') version = None @@ -109,8 +117,19 @@ if __name__ == '__main__': print(f"InvenTree Version: '{version}'") # Check version number and look for existing versions - # Note that on a 'tag' (release) we *must* allow duplicate versions, as this *is* the version that has just been released - highest_release = check_version_number(version, allow_duplicate=GITHUB_REF_TYPE == 'tag') + # If a release is found which matches the current tag, throw an error + + allow_duplicate = False + + # Note: on a 'tag' (release) we *must* allow duplicate versions, as this *is* the version that has just been released + if GITHUB_REF_TYPE == 'tag': + allow_duplicate = True + + # Note: on a push to 'stable' branch we also allow duplicates + if GITHUB_BASE_REF == 'stable': + allow_duplicate = True + + highest_release = check_version_number(version, allow_duplicate=allow_duplicate) # Determine which docker tag we are going to use docker_tags = None