From 38e6dbd9d27414df9ae70235cef030f8f938252c Mon Sep 17 00:00:00 2001 From: tengxianglin Date: Thu, 8 Aug 2024 14:01:47 +0800 Subject: [PATCH] Update multi version --- .github/workflows/web_update.yml | 2 +- docs/update_quairkit_rst.py | 10 +++++----- version.sh | 6 +++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/web_update.yml b/.github/workflows/web_update.yml index 253ca76..fc952e4 100644 --- a/.github/workflows/web_update.yml +++ b/.github/workflows/web_update.yml @@ -25,7 +25,7 @@ jobs: uses: actions/configure-pages@v5 - name: Cache pip # Step to cache pip packages. - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/docs/update_quairkit_rst.py b/docs/update_quairkit_rst.py index 225a0eb..3687a7b 100644 --- a/docs/update_quairkit_rst.py +++ b/docs/update_quairkit_rst.py @@ -250,7 +250,8 @@ def _update_conf_py(source_directory: str = _sphinx_source_dir): html_short_title = "QuAIRKit" build_dir = "api" html_theme_options = { - 'repo_url': 'https://github.com/QuAIR/QuAIRKit', + "repo_url": 'https://github.com/QuAIR/QuAIRKit', + "repo_name": 'QuAIRKit', "palette": { "primary": "green" }, "version_dropdown": True, "version_json": "versions.json", @@ -297,10 +298,9 @@ def _create_redirect_html(): """ - - file_path = os.path.join(".", "docs", "api", "index.html") - - with open(file_path, 'w', encoding='utf-8') as file: + file_dir = os.path.join(".", "docs", "api") + os.makedirs(file_dir, exist_ok=True) + with open(os.path.join(file_dir, "index.html"), 'w', encoding='utf-8') as file: file.write(html_content) diff --git a/version.sh b/version.sh index 492f794..2566405 100644 --- a/version.sh +++ b/version.sh @@ -1,5 +1,9 @@ #!/bin/bash +# Update system repositories and install Pandoc +sudo apt-get update +sudo apt-get install -y pandoc + # Check and install the Sphinx Material theme and nbsphinx if not already installed pip show sphinx_immaterial || pip install sphinx_immaterial pip show nbsphinx || pip install nbsphinx @@ -62,8 +66,8 @@ done git checkout $current_branch # Build the final Sphinx documentation for the current branch -cp -r tutorials docs/sphinx_src/ python docs/update_quairkit_rst.py +cp -r tutorials docs/sphinx_src/tutorials echo "$version_info_content" >> docs/sphinx_src/conf.py sphinx-build docs/sphinx_src docs/api/latest