actions-github (#58)
Reviewed-on: #58 Reviewed-by: Tino Schreiber <tino.schreiber@t-systems.com> Co-authored-by: Gode, Sebastian <sebastian.gode@t-systems.com> Co-committed-by: Gode, Sebastian <sebastian.gode@t-systems.com>
This commit is contained in:
@ -356,8 +356,10 @@ def process_repositories(args, service):
|
||||
context["docs"].append(doc)
|
||||
if args.cloud_environment == "swiss":
|
||||
context["template"] = "helpcenter-swiss-base-jobs"
|
||||
elif args.cloud_environment == "eu_de":
|
||||
elif args.cloud_environment == "eu_de" and args.target_environment == "internal":
|
||||
context["template"] = "helpcenter-base-jobs"
|
||||
elif args.cloud_environment == "eu_de" and args.target_environment == "public":
|
||||
context["template"] = "helpcenter-base-jobs-no-check"
|
||||
context["service_type"] = service['service_type']
|
||||
|
||||
zuul_yaml_content = zuul_yaml_template.render(**context)
|
||||
@ -371,21 +373,33 @@ def process_repositories(args, service):
|
||||
"""Update actions"""
|
||||
context = dict(docs=[])
|
||||
context["service_uri"] = service['service_uri']
|
||||
context["environment"] = args.target_environment
|
||||
|
||||
actions_yaml_content_html = actions_yaml_template_html.render(**context)
|
||||
actions_yaml_content_pdf = actions_yaml_template_pdf.render(**context)
|
||||
actions_yaml_content_html_path = pathlib.Path(copy_to, ".gitea", "workflows", "build-html-docs.yaml")
|
||||
actions_yaml_content_html_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
actions_yaml_content_pdf_path = pathlib.Path(copy_to, ".gitea", "workflows", "build-pdf-docs.yaml")
|
||||
actions_yaml_content_pdf_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
if args.target_environment == "internal":
|
||||
actions_yaml_content_html_path = pathlib.Path(copy_to, ".gitea", "workflows", "build-html-docs.yaml")
|
||||
actions_yaml_content_html_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
actions_yaml_content_pdf_path = pathlib.Path(copy_to, ".gitea", "workflows", "build-pdf-docs.yaml")
|
||||
actions_yaml_content_pdf_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
elif args.target_environment == "public":
|
||||
actions_yaml_content_html_path = pathlib.Path(copy_to, ".github", "workflows", "build-html-docs.yaml")
|
||||
actions_yaml_content_html_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
actions_yaml_content_pdf_path = pathlib.Path(copy_to, ".github", "workflows", "build-pdf-docs.yaml")
|
||||
actions_yaml_content_pdf_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with open(actions_yaml_content_html_path, "w", encoding="utf-8", newline="") as out:
|
||||
logging.debug(f"Generating {actions_yaml_content_html_path} from template...")
|
||||
out.write(actions_yaml_content_html)
|
||||
repo_to.index.add([".gitea/workflows/build-html-docs.yaml"])
|
||||
with open(actions_yaml_content_pdf_path, "w", encoding="utf-8", newline="") as out:
|
||||
logging.debug(f"Generating {actions_yaml_content_pdf_path} from template...")
|
||||
out.write(actions_yaml_content_pdf)
|
||||
repo_to.index.add([".gitea/workflows/build-pdf-docs.yaml"])
|
||||
if args.target_environment == "internal":
|
||||
repo_to.index.add([".gitea/workflows/build-html-docs.yaml"])
|
||||
repo_to.index.add([".gitea/workflows/build-pdf-docs.yaml"])
|
||||
elif args.target_environment == "public":
|
||||
repo_to.index.add([".github/workflows/build-html-docs.yaml"])
|
||||
repo_to.index.add([".github/workflows/build-pdf-docs.yaml"])
|
||||
|
||||
if len(repo_to.index.diff("HEAD")) == 0:
|
||||
# Nothing to commit
|
||||
|
Reference in New Issue
Block a user