release helper script .scripts/transform_files.py updates theme references in all *.md and *.puml files too (already used with v2.7.0)

pull/317/head
KIRCHSTH 3 years ago
parent 9b46e9b24d
commit 7ab9cdfcc3

@ -229,7 +229,7 @@ def update_c4_next_beta_version():
def update_all_includes():
# reference tag version is with starting 'v'
print(f"updating include paths with new tag version {release_version} ...")
print(f"updating include/theme paths with new tag version {release_version} ...")
files = glob.glob("./**/*", recursive=True)
for file in files:
if file.endswith(".puml") or file.endswith(".md"):
@ -239,8 +239,17 @@ def update_all_includes():
"!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/",
f"!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/",
)
print("include paths updated")
replace_in_file(
file,
"from https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/",
f"from https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/",
)
replace_in_file(
file,
"](https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/themes/",
f"](https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/themes/",
)
print(f"include/theme paths updated")
def process_url_match(m: re.Match[str]):
@ -254,6 +263,14 @@ def process_url_match(m: re.Match[str]):
"!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/",
new_path,
)
replaced = replaced.replace(
"from https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/",
f"from https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/",
)
replaced = replaced.replace(
"](https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/themes/",
f"](https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/themes/",
)
if new_path not in replaced:
global found_not_replaced_include

Loading…
Cancel
Save