mirror of
https://github.com/Z3Prover/z3
synced 2026-02-09 10:35:36 +00:00
version updated on workflows
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
c89c01dedf
commit
bc388672c1
1 changed files with 10 additions and 59 deletions
|
|
@ -16,8 +16,13 @@ import sys
|
|||
def read_version():
|
||||
"""Read version from VERSION.txt file."""
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# VERSION.txt is now in scripts directory
|
||||
version_file = os.path.join(script_dir, 'VERSION.txt')
|
||||
|
||||
if not os.path.exists(version_file):
|
||||
print(f"VERSION.txt not found at {version_file}")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
with open(version_file, 'r') as f:
|
||||
version = f.read().strip()
|
||||
|
|
@ -57,69 +62,16 @@ def update_bazel_module(version):
|
|||
except IOError as e:
|
||||
print(f"Error updating MODULE.bazel: {e}")
|
||||
|
||||
def update_nightly_yaml(version):
|
||||
"""Update scripts/nightly.yaml with the version."""
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
nightly_file = os.path.join(script_dir, 'nightly.yaml')
|
||||
|
||||
version_parts = version.split('.')
|
||||
if len(version_parts) >= 3:
|
||||
major, minor, patch = version_parts[0], version_parts[1], version_parts[2]
|
||||
else:
|
||||
print(f"Warning: Invalid version format in VERSION.txt: {version}")
|
||||
return
|
||||
|
||||
try:
|
||||
with open(nightly_file, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Update Major, Minor, Patch variables
|
||||
content = re.sub(r"(\s+Major:\s*')[^']*('.*)", r"\g<1>" + major + r"\g<2>", content)
|
||||
content = re.sub(r"(\s+Minor:\s*')[^']*('.*)", r"\g<1>" + minor + r"\g<2>", content)
|
||||
content = re.sub(r"(\s+Patch:\s*')[^']*('.*)", r"\g<1>" + patch + r"\g<2>", content)
|
||||
|
||||
with open(nightly_file, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
print(f"Updated nightly.yaml version to {major}.{minor}.{patch}")
|
||||
except IOError as e:
|
||||
print(f"Error updating nightly.yaml: {e}")
|
||||
|
||||
def update_release_yml(version):
|
||||
"""Update scripts/release.yml with the version."""
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
release_file = os.path.join(script_dir, 'release.yml')
|
||||
|
||||
# Extract major.minor.patch from major.minor.patch.tweak
|
||||
version_parts = version.split('.')
|
||||
if len(version_parts) >= 3:
|
||||
release_version = f"{version_parts[0]}.{version_parts[1]}.{version_parts[2]}"
|
||||
else:
|
||||
release_version = version
|
||||
|
||||
try:
|
||||
with open(release_file, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Update ReleaseVersion variable
|
||||
content = re.sub(
|
||||
r"(\s+ReleaseVersion:\s*')[^']*('.*)",
|
||||
r"\g<1>" + release_version + r"\g<2>",
|
||||
content
|
||||
)
|
||||
|
||||
with open(release_file, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
print(f"Updated release.yml version to {release_version}")
|
||||
except IOError as e:
|
||||
print(f"Error updating release.yml: {e}")
|
||||
|
||||
def update_github_nightly_yml(version):
|
||||
"""Update .github/workflows/nightly.yml with the version."""
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
nightly_file = os.path.join(os.path.dirname(script_dir), '.github', 'workflows', 'nightly.yml')
|
||||
|
||||
if not os.path.exists(nightly_file):
|
||||
print(f"Warning: {nightly_file} does not exist, skipping")
|
||||
return
|
||||
|
||||
version_parts = version.split('.')
|
||||
if len(version_parts) >= 3:
|
||||
major, minor, patch = version_parts[0], version_parts[1], version_parts[2]
|
||||
|
|
@ -154,8 +106,6 @@ def main():
|
|||
print("\nUpdating files that cannot auto-read VERSION.txt...")
|
||||
|
||||
update_bazel_module(version)
|
||||
update_nightly_yaml(version)
|
||||
update_release_yml(version)
|
||||
update_github_nightly_yml(version)
|
||||
|
||||
print("\nUpdate complete!")
|
||||
|
|
@ -163,6 +113,7 @@ def main():
|
|||
print(" - CMakeLists.txt")
|
||||
print(" - scripts/mk_project.py")
|
||||
print("\nThese do not need manual updates.")
|
||||
print("\nNote: .github/workflows/release.yml uses input parameters, not hardcoded versions.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue