* Remove Core5Compat * Remove hack * Update ChangeLog * Revert "Remove hack" This reverts commit dda3ad05818d346fdfcbb41944b9e731a4b547c0. * Set `add_compile_definitions` for Qt * Revert "Set `add_compile_definitions` for Qt" This reverts commit 0258d2d226a76081068f4e565855f37993953be5. * Use arm64_monterey bottle * Revert "Use arm64_monterey bottle" This reverts commit a46d743dc6883c925e2328b9628231189cb34367. * Use aqt to install Qt on Mac * Append env var instead of overwrite * Fixed filename * Use GITHUB_PATH * Restore original GITHUB_ENV logic * Use newer cache action * Update ChangeLog
37 lines
983 B
Python
37 lines
983 B
Python
import os
|
|
|
|
github_env_key = "GITHUB_ENV"
|
|
github_path_key = "GITHUB_PATH"
|
|
|
|
|
|
def set_env_var(key, value):
|
|
"""
|
|
Appends the key=value pair to the GitHub environment file.
|
|
"""
|
|
env_file = os.getenv(github_env_key)
|
|
if not env_file:
|
|
raise RuntimeError(f"Env var {github_env_key} not set")
|
|
|
|
if not os.path.exists(env_file):
|
|
raise RuntimeError(f"File not found: {env_file}")
|
|
|
|
print(f"Setting GitHub env var: {key}={value}")
|
|
with open(env_file, "a") as env_file:
|
|
env_file.write(f"{key}={value}\n")
|
|
|
|
|
|
def add_to_path(value):
|
|
"""
|
|
Appends the value to the GitHub path.
|
|
"""
|
|
path_file = os.getenv(github_path_key)
|
|
if not path_file:
|
|
raise RuntimeError(f"Env var {github_path_key} not set")
|
|
|
|
if not os.path.exists(path_file):
|
|
raise RuntimeError(f"File not found: {path_file}")
|
|
|
|
print(f"Adding to GitHub path: {value}")
|
|
with open(path_file, "a") as path_file:
|
|
path_file.write(f"{value}\n")
|