diff --git a/deployment/version_getter.py b/deployment/version_getter.py index e225b171..829e0542 100644 --- a/deployment/version_getter.py +++ b/deployment/version_getter.py @@ -4,12 +4,27 @@ yaml = ruamel.yaml.YAML() yaml.preserve_quotes = True -ctor_fname = os.path.join("construct.yaml") -with open(ctor_fname, "r") as stream: +# Get the current OS name from the environment variable +current_os = os.environ.get('RUNNER_OS').lower() # Ensure lowercase for comparison + +# Construct the filename based on OS name (consider all possibilities) +if current_os == 'windows': + construct_file = os.path.join("construct_windows-latest.yaml") +elif current_os == 'linux': + construct_file = os.path.join("construct_ubuntu-latest.yaml") # Assuming ubuntu-latest for Linux +# Add an else block if you plan to support macOS in the future +else: + raise Exception(f"Unsupported OS: {current_os}") + +# Load YAML using ruamel.yaml +yaml = ruamel.yaml.YAML() +yaml.preserve_quotes = True + +with open(construct_file, "r") as stream: ctor_conf = yaml.load(stream) ctor_conf["version"] = runpy.run_path(os.path.join("..", "micro_sam", "__version__.py"))["__version__"] -with open(ctor_fname, "w") as outfile: - yaml.dump(ctor_conf, outfile) +with open(construct_file, "w") as outfile: + yaml.dump(ctor_conf, outfile) \ No newline at end of file