diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index a69d826f..80da610a 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-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: "Install the library to get the version" + shell: bash + run: | + python -m pip install -e . + + - 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]))") + 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..6b9cb97b 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -2,7 +2,12 @@ from datetime import datetime import os -from ansys_sphinx_theme import get_version_match, pyansys_logo_black +from ansys_sphinx_theme import ( + ansys_favicon, + 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 +19,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 @@ -23,6 +29,9 @@ html_theme = "ansys_sphinx_theme" html_short_title = html_title = "PyAnsys" +# Favicon +html_favicon = ansys_favicon + extensions = [ "sphinx_design", "sphinx_copybutton", @@ -58,6 +67,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