diff --git a/otc_metadata/templates/build-html-docs.yaml.j2 b/otc_metadata/templates/build-html-docs.yaml.j2
new file mode 100644
index 0000000..ebd6bbc
--- /dev/null
+++ b/otc_metadata/templates/build-html-docs.yaml.j2
@@ -0,0 +1,30 @@
+name: Build HTML Docs
+on:
+ pull_request:
+ types: [opened, reopened, synchronize, edited]
+jobs:
+ tox-docs:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: https://github.com/opentelekomcloud-infra/github-actions/.github/actions/tox-run-env@v1
+ with:
+ tox-env: docs
+
+ - name: Upload documentation preview
+ uses: https://github.com/opentelekomcloud-infra/github-actions/.github/actions/tox-upload-swift@v1
+ with:
+ docs_path: "doc/build/html"
+ docs_service: {{ service_uri }}
+ swift_container: "gitea_action_logs"
+ {% raw -%}
+ otc_swift_username: ${{ secrets.OTC_SWIFT_USERNAME }}
+ otc_swift_password: ${{ secrets.OTC_SWIFT_PASSWORD }}
+ otc_swift_project_name: ${{ secrets.OTC_SWIFT_PROJECT_NAME }}
+ otc_swift_domain: ${{ secrets.OTC_SWIFT_DOMAIN }}
+ otc_swift_endpoint: ${{ secrets.OTC_SWIFT_ENDPOINT }}
+ gitea_token: ${{ secrets.GITEA_TOKEN }}
+ gitea_server_url: ${{ gitea.server_url }}
+ repo: ${{ gitea.repository }}
+ pr_number: ${{ gitea.event.pull_request.number }}
+ run_id: ${{ gitea.run_id }}
+ {%- endraw %}
\ No newline at end of file
diff --git a/otc_metadata/templates/build-pdf-docs.yaml.j2 b/otc_metadata/templates/build-pdf-docs.yaml.j2
new file mode 100644
index 0000000..472c8ef
--- /dev/null
+++ b/otc_metadata/templates/build-pdf-docs.yaml.j2
@@ -0,0 +1,30 @@
+name: Build PDF Docs
+on:
+ pull_request:
+ types: [opened, reopened, synchronize, edited]
+jobs:
+ tox-pdf-docs:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: https://github.com/opentelekomcloud-infra/github-actions/.github/actions/tox-run-env@v1
+ with:
+ tox-env: pdf-docs
+
+ - name: Upload documentation preview
+ uses: https://github.com/opentelekomcloud-infra/github-actions/.github/actions/tox-upload-swift@v1
+ with:
+ docs_path: "doc/build/pdf"
+ docs_service: {{ service_uri }}
+ swift_container: "gitea_action_logs"
+ {% raw -%}
+ otc_swift_username: ${{ secrets.OTC_SWIFT_USERNAME }}
+ otc_swift_password: ${{ secrets.OTC_SWIFT_PASSWORD }}
+ otc_swift_project_name: ${{ secrets.OTC_SWIFT_PROJECT_NAME }}
+ otc_swift_domain: ${{ secrets.OTC_SWIFT_DOMAIN }}
+ otc_swift_endpoint: ${{ secrets.OTC_SWIFT_ENDPOINT }}
+ gitea_token: ${{ secrets.GITEA_TOKEN }}
+ gitea_server_url: ${{ gitea.server_url }}
+ repo: ${{ gitea.repository }}
+ pr_number: ${{ gitea.event.pull_request.number }}
+ run_id: ${{ gitea.run_id }}
+ {%- endraw %}
\ No newline at end of file
diff --git a/tools/generate_doc_confpy.py b/tools/generate_doc_confpy.py
index b5af54b..4691d9c 100644
--- a/tools/generate_doc_confpy.py
+++ b/tools/generate_doc_confpy.py
@@ -54,6 +54,8 @@ def process_repositories(args, service):
zuul_yaml_template = env.get_template("zuul.yaml.j2")
index_sbv_template = env.get_template("index_sbv.rst.j2")
doc_requirements_template = env.get_template("doc_requirements.txt.j2")
+ actions_yaml_template_html = env.get_template("build-html-docs.yaml.j2")
+ actions_yaml_template_pdf = env.get_template("build-pdf-docs.yaml.j2")
for repo in service["repositories"]:
if repo["cloud_environments"][0] == args.cloud_environment:
@@ -365,6 +367,26 @@ def process_repositories(args, service):
out.write(zuul_yaml_content)
repo_to.index.add(["zuul.yaml"])
+ if args.update_actions:
+ """Update actions"""
+ context = dict(docs=[])
+ context["service_uri"] = service['service_uri']
+
+ 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)
+ 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 len(repo_to.index.diff("HEAD")) == 0:
# Nothing to commit
logging.debug(
@@ -464,6 +486,11 @@ def main():
action="store_true",
help="Whether to update zuul.yaml"
)
+ parser.add_argument(
+ "--update-actions",
+ action="store_true",
+ help="Whether to update the action yaml files for rendering docs."
+ )
parser.add_argument(
"--overwrite-index-sbv",
action="store_true",