From 9a2f2d91c82963a1be3f075a29a1a2ea587acb57 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 16 Aug 2023 10:12:44 +0200 Subject: [PATCH 1/4] feat: add the meilisearch index --- .github/workflows/ci-build.yml | 43 +++++++++++++++++++++++++++++++++- doc/source/conf.py | 13 +++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index a69d826f..3e702e1b 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -17,6 +17,8 @@ env: PACKAGE_NAMESPACE: pyansys MAIN_PYTHON_VERSION: '3.11' DOCUMENTATION_CNAME: "docs.pyansys.com" + MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} + MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }} jobs: @@ -137,13 +139,22 @@ jobs: python-version: ${{ env.MAIN_PYTHON_VERSION }} dependencies: "build-essential zip pandoc texlive-latex-extra latexmk texlive-pstricks" - - name: Deploy the latest documentation + - name: Deploy the dev documentation uses: ansys/actions/doc-deploy-dev@v4 if: github.ref == 'refs/heads/main' with: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} + - name: "Deploy the dev documentation index" + uses: ansys/actions/doc-deploy-index@v4 + if: github.ref == 'refs/heads/main' + with: + cname: ${{ env.DOCUMENTATION_CNAME }}/version/dev + index-name: "pyansys-vdev" + host-url: ${{ vars.MEILISEARCH_HOST_URL }} + api-key: ${{ env.MEILISEARCH_API_KEY }} + package: name: Package library runs-on: ubuntu-latest @@ -184,3 +195,33 @@ jobs: with: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} + + doc-index-stable: + name: "Deploy stable docs index" + runs-on: ubuntu-latest + needs: docs-release + steps: + - name: "Install Git and clone project" + uses: actions/checkout@v3 + + - name: "get version of library" + shell: bash + run: | + python -m pip install -e . + + - name: Scrape the stable documentation to PyMeilisearch + run: | + VERSION=$(python -c "from ${{ env.PACKAGE_NAMESPACE }} import __version__; print('.'.join(__version__.split('.')[:2]))") + VERSION_MEILI=$(python -c "from ${{ env.PACKAGE_NAMESPACE }} import __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: pyansys-v${{ env.VERSION_MEILI }} + host-url: ${{ vars.MEILISEARCH_HOST_URL }} + api-key: ${{ env.MEILISEARCH_API_KEY }} diff --git a/doc/source/conf.py b/doc/source/conf.py index 13f8b7e6..453e6a12 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -2,7 +2,11 @@ from datetime import datetime import os -from ansys_sphinx_theme import get_version_match, pyansys_logo_black +from ansys_sphinx_theme import ( + convert_version_to_pymeilisearch, + get_version_match, + pyansys_logo_black, +) from sphinx.builders.latex import LaTeXBuilder from pyansys import __version__ as pyansys_version @@ -14,6 +18,7 @@ author = "ANSYS Inc." cname = os.getenv("DOCUMENTATION_CNAME", default="nocname.com") switcher_version = get_version_match(pyansys_version) +meilisearch_version = convert_version_to_pymeilisearch(pyansys_version) # get the PyAnsys version release = version = pyansys_version @@ -58,6 +63,12 @@ "version_match": switcher_version, }, "check_switcher": False, + "use_meilisearch": { + "api_key": os.getenv("MEILISEARCH_PUBLIC_API_KEY", ""), + "index_uids": { + f"pyansys-v{meilisearch_version}": "PyAnsys", + }, + }, } # Check all references work fine From 4e72f45afad2c4bddce99d5c6f8ac2e84fcd3014 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 16 Aug 2023 10:17:17 +0200 Subject: [PATCH 2/4] docs: fix typo in strings --- .github/workflows/ci-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 3e702e1b..ad39de74 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -196,20 +196,20 @@ jobs: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} - doc-index-stable: - name: "Deploy stable docs index" + doc-index-release: + name: "Deploy release docs index" runs-on: ubuntu-latest needs: docs-release steps: - name: "Install Git and clone project" uses: actions/checkout@v3 - - name: "get version of library" + - name: "install the library to get the version" shell: bash run: | python -m pip install -e . - - name: Scrape the stable documentation to PyMeilisearch + - name: "get version of library" run: | VERSION=$(python -c "from ${{ env.PACKAGE_NAMESPACE }} import __version__; print('.'.join(__version__.split('.')[:2]))") VERSION_MEILI=$(python -c "from ${{ env.PACKAGE_NAMESPACE }} import __version__; print('-'.join(__version__.split('.')[:2]))") From 75f4cb00df73face363b78f83f44a143253c6195 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 16 Aug 2023 10:19:46 +0200 Subject: [PATCH 3/4] docs: add favicon --- doc/source/conf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 453e6a12..6b9cb97b 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -3,6 +3,7 @@ import os from ansys_sphinx_theme import ( + ansys_favicon, convert_version_to_pymeilisearch, get_version_match, pyansys_logo_black, @@ -28,6 +29,9 @@ html_theme = "ansys_sphinx_theme" html_short_title = html_title = "PyAnsys" +# Favicon +html_favicon = ansys_favicon + extensions = [ "sphinx_design", "sphinx_copybutton", From c82c79bd730ec1a30660628a0ce23a994986a0ed Mon Sep 17 00:00:00 2001 From: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com> Date: Wed, 16 Aug 2023 10:30:18 +0200 Subject: [PATCH 4/4] doc: improve docstring Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- .github/workflows/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index ad39de74..80da610a 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -204,12 +204,12 @@ jobs: - name: "Install Git and clone project" uses: actions/checkout@v3 - - name: "install the library to get the version" + - name: "Install the library to get the version" shell: bash run: | python -m pip install -e . - - name: "get version of library" + - name: "Get the version of the library" run: | VERSION=$(python -c "from ${{ env.PACKAGE_NAMESPACE }} import __version__; print('.'.join(__version__.split('.')[:2]))") VERSION_MEILI=$(python -c "from ${{ env.PACKAGE_NAMESPACE }} import __version__; print('-'.join(__version__.split('.')[:2]))")