From da4fffda5dcd08c295405bf8468f9769f371bc3d Mon Sep 17 00:00:00 2001 From: Robert Shubert Date: Fri, 20 Dec 2024 13:09:06 +0000 Subject: [PATCH] Create mkdocs build.yml Signed-off-by: Robert Shubert --- mkdocs build.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 mkdocs build.yml diff --git a/mkdocs build.yml b/mkdocs build.yml new file mode 100644 index 0000000..90ba866 --- /dev/null +++ b/mkdocs build.yml @@ -0,0 +1,35 @@ +import subprocess +import os + +# Create a temporary directory for testing the build process +build_test_dir = "/mnt/data/mkdocs_build_test" +os.makedirs(build_test_dir, exist_ok=True) + +# Place a mock MkDocs project structure in the directory +docs_dir = os.path.join(build_test_dir, "docs") +os.makedirs(docs_dir, exist_ok=True) + +# Create basic files for testing +with open(os.path.join(build_test_dir, "mkdocs.yml"), "w") as f: + f.write("""\ +site_name: Test Documentation +nav: + - Home: index.md +theme: + name: material +plugins: + - search +""") + +with open(os.path.join(docs_dir, "index.md"), "w") as f: + f.write("# Welcome to MkDocs\n\nThis is a test documentation.") + +# Test the MkDocs build command +try: + build_output_dir = os.path.join(build_test_dir, "site") + subprocess.run(["mkdocs", "build", "--clean", "--site-dir", build_output_dir], check=True) + build_result = {"status": "success", "output_dir": build_output_dir} +except subprocess.CalledProcessError as e: + build_result = {"status": "failure", "error": str(e)} + +build_result