@@ -54,20 +54,30 @@ def main():
5454 print (f"Couldn't match the given stack version { stack_version !r} " )
5555 exit (1 )
5656
57+ # Pad the version value with .0 until there
58+ # we have the major, minor, and patch.
59+ for _ in range (3 ):
60+ if len (python_version .split ("." )) >= 3 :
61+ break
62+ python_version += ".0"
63+
5764 find_and_replace (
5865 path = SOURCE_DIR / "elasticsearch/_version.py" ,
5966 pattern = r"__versionstr__ = \"[0-9]+[0-9\.]*[0-9](?:\+dev)?\"" ,
6067 replace = f'__versionstr__ = "{ python_version } "' ,
6168 )
69+
70+ # These values should always be the 'major.minor-SNAPSHOT'
71+ major_minor_version = "." .join (python_version .split ("." )[:2 ])
6272 find_and_replace (
6373 path = SOURCE_DIR / ".ci/test-matrix.yml" ,
64- pattern = r" STACK_VERSION:\s+\- [0-9]+[0-9\.]*[0-9]-SNAPSHOT" ,
65- replace = f" STACK_VERSION:\n - { stack_version } " ,
74+ pattern = r' STACK_VERSION:\s+\- " [0-9]+[0-9\.]*[0-9](?:\ -SNAPSHOT)?"' ,
75+ replace = f' STACK_VERSION:\n - " { major_minor_version } .0-SNAPSHOT"' ,
6676 )
6777 find_and_replace (
6878 path = SOURCE_DIR / ".github/workflows/unified-release.yml" ,
69- pattern = r"stack_version: \['[ 0-9]+[0-9\.]*[0-9]-SNAPSHOT'\]" ,
70- replace = f"stack_version: [' { stack_version } ']" ,
79+ pattern = r'STACK_VERSION:\s+"[ 0-9]+[0-9\.]*[0-9](?:\ -SNAPSHOT)?"' ,
80+ replace = f'STACK_VERSION: " { major_minor_version } -SNAPSHOT"' ,
7181 )
7282
7383
0 commit comments