From 29bfbe3fa4c81820326bdbdb4309d6902d0d4092 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 26 Sep 2023 11:37:36 +0200 Subject: [PATCH 1/6] feat: add meilisearch indexing --- .github/workflows/ci.yml | 17 +++++++++++++++++ .github/workflows/releaser.yml | 30 ++++++++++++++++++++++++++++++ docs/source/conf.py | 7 +++++++ 3 files changed, 54 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 575111be6f..9e72ca4a5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,8 @@ concurrency: env: DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com' MAIN_PYTHON_VERSION: '3.8' + MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} + MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }} jobs: debug: @@ -98,6 +100,21 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} doc-artifact-name: HTML-doc-ansys-dpf-core.zip decompress-artifact: true + + doc-index-dev: + name: "Deploy dev index docs" + runs-on: ubuntu-latest + needs: upload-development-docs + steps: + - name: "Deploy the latest documentation index" + uses: ansys/actions/doc-deploy-index@v4 + with: + cname: ${{ env.DOCUMENTATION_CNAME }}/version/dev + index-name: pydpf-core-vdev + host-url: ${{ vars.MEILISEARCH_HOST_URL }} + api-key: ${{ env.MEILISEARCH_API_KEY }} + doc-artifact-name: HTML-doc-ansys-dpf-core.zip + decompress-artifact: true examples: if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 7c648a9c6b..49f55c330b 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -57,3 +57,33 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} doc-artifact-name: HTML-doc-ansys-dpf-core.zip decompress-artifact: true + + doc-index-stable: + name: "Deploy stable docs index" + runs-on: ubuntu-latest + needs: upload_docs_release + steps: + - name: "Install Git and clone project" + uses: actions/checkout@v4 + - name: "get version of library" + shell: bash + run: | + echo "FULL_VERSION=$(cat VERSION)" >> $GITHUB_ENV + + - name: "Scrape the stable documentation to PyMeilisearch" + run: | + VERSION=$(python -c "import os; version=os.environ['FULL_VERSION']; print('.'.join(version.split('.')[:2]))") + VERSION_MEILI=$(python -c "import os; version=os.environ['FULL_VERSION']; print('-'.join(version.split('.')[:2]))") + echo "Calculated VERSION: $VERSION" + echo "Calculated VERSION_MEILI: $VERSION_MEILI" + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "VERSION_MEILI=$VERSION_MEILI" >> $GITHUB_ENV + - name: "Deploy the latest documentation index" + uses: ansys/actions/doc-deploy-index@v4 + with: + cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }} + index-name: pydpf-core-v${{ env.VERSION_MEILI }} + host-url: ${{ vars.MEILISEARCH_HOST_URL }} + api-key: ${{ env.MEILISEARCH_API_KEY }} + doc-artifact-name: HTML-doc-ansys-dpf-core.zip + decompress-artifact: true diff --git a/docs/source/conf.py b/docs/source/conf.py index ee10796ec3..27b1e7f999 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -199,9 +199,16 @@ def reset_servers(gallery_conf, fname, when): "version_match": get_version_match(__version__), }, "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], + "use_meilisearch": { + "api_key": os.getenv("MEILISEARCH_PUBLIC_API_KEY", ""), + "index_uids": { + f"pydpf-core-v{get_version_match(__version__).replace('.', '-')}": "PyMAPDL", + }, + }, } + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". From f99cdc4a5f71aeb18bc6ffe2dba72a9ea179c7ad Mon Sep 17 00:00:00 2001 From: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:40:35 +0200 Subject: [PATCH 2/6] fix: Update docs/source/conf.py --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 27b1e7f999..24623337d2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -202,7 +202,7 @@ def reset_servers(gallery_conf, fname, when): "use_meilisearch": { "api_key": os.getenv("MEILISEARCH_PUBLIC_API_KEY", ""), "index_uids": { - f"pydpf-core-v{get_version_match(__version__).replace('.', '-')}": "PyMAPDL", + f"pydpf-core-v{get_version_match(__version__).replace('.', '-')}": "PyDPF-Core", }, }, } From 67af19807b5d3ba32635a41ffb7996ac73a7db23 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 27 Sep 2023 12:09:37 +0200 Subject: [PATCH 3/6] fix: env variable --- .github/workflows/releaser.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 49f55c330b..9fbfdcbcd5 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -7,6 +7,8 @@ on: env: DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com' PYTHON_MAIN_VERSION: '3.10' + MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} + MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }} jobs: From 6b8e7ca2a27e4a69bbbeefb4dc19d7d0e03ff65b Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 27 Sep 2023 12:10:29 +0200 Subject: [PATCH 4/6] fix: indentation --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 24623337d2..d6c82e7a73 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -199,7 +199,7 @@ def reset_servers(gallery_conf, fname, when): "version_match": get_version_match(__version__), }, "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], - "use_meilisearch": { + "use_meilisearch": { "api_key": os.getenv("MEILISEARCH_PUBLIC_API_KEY", ""), "index_uids": { f"pydpf-core-v{get_version_match(__version__).replace('.', '-')}": "PyDPF-Core", From 32c25f786e1ae1da82331477813690101fae3d44 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 28 Sep 2023 12:02:41 +0200 Subject: [PATCH 5/6] fix: the version --- .github/workflows/releaser.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 9fbfdcbcd5..1fc9adc9f4 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -67,15 +67,13 @@ jobs: steps: - name: "Install Git and clone project" uses: actions/checkout@v4 - - name: "get version of library" - shell: bash - run: | - echo "FULL_VERSION=$(cat VERSION)" >> $GITHUB_ENV - - - name: "Scrape the stable documentation to PyMeilisearch" + - name: "Install the package requirements" + run: pip install -e . + + - name: "Get the version to PyMeilisearch" run: | - VERSION=$(python -c "import os; version=os.environ['FULL_VERSION']; print('.'.join(version.split('.')[:2]))") - VERSION_MEILI=$(python -c "import os; version=os.environ['FULL_VERSION']; print('-'.join(version.split('.')[:2]))") + VERSION=$(python -c "from ansys.dpf.core import __version__; print('.'.join(__version__.split('.')[:2]))") + VERSION_MEILI=$(python -c "from ansys.dpf.core import __version__; print('-'.join(__version__.split('.')[:2]))") echo "Calculated VERSION: $VERSION" echo "Calculated VERSION_MEILI: $VERSION_MEILI" echo "VERSION=$VERSION" >> $GITHUB_ENV From 03046a80602949c999afe94e907430048928ed7b Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 28 Sep 2023 12:02:47 +0200 Subject: [PATCH 6/6] fix: the version --- .github/workflows/releaser.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 1fc9adc9f4..70e13f0c8f 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -67,6 +67,7 @@ jobs: steps: - name: "Install Git and clone project" uses: actions/checkout@v4 + - name: "Install the package requirements" run: pip install -e . @@ -78,6 +79,7 @@ jobs: echo "Calculated VERSION_MEILI: $VERSION_MEILI" echo "VERSION=$VERSION" >> $GITHUB_ENV echo "VERSION_MEILI=$VERSION_MEILI" >> $GITHUB_ENV + - name: "Deploy the latest documentation index" uses: ansys/actions/doc-deploy-index@v4 with: