diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 15086cf1e..1df6d60a3 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -42,6 +42,9 @@ env: STABLE_REVN: '231' # ensure this matches inputs.stable-revn.default EXPERIMENTAL_REVN: '232' # ensure this matches inputs.experimental-revn.default DEV_REVN: '241' + MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} + MEILISEARCH_HOST_URL: ${{ vars.MEILISEARCH_HOST_URL }} + MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }} concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -599,6 +602,21 @@ jobs: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} + doc-index-dev: + name: "Deploy dev index docs" + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: upload_dev_docs + steps: + - name: "Deploy the latest documentation index" + uses: ansys/actions/doc-deploy-index@v4 + with: + cname: ${{ env.DOCUMENTATION_CNAME }}/version/dev + index-name: pymechanical-vdev + host-url: ${{ env.MEILISEARCH_HOST_URL }} + api-key: ${{ env.MEILISEARCH_API_KEY }} + python-version: ${{ env.MAIN_PYTHON_VERSION }} + upload_docs_release: name: Upload release documentation if: github.event_name == 'push' && contains(github.ref, 'refs/tags') @@ -610,4 +628,32 @@ jobs: with: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} - python-version: ${{ env.MAIN_PYTHON_VERSION }} + + 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: "Install the package requirements" + run: pip install -e . + + - name: "Get the version to PyMeilisearch" + run: | + VERSION=$(python -c "from ansys.mechanical.core import __version__; print('.'.join(__version__.split('.')[:2]))") + VERSION_MEILI=$(python -c "from ansys.mechanical.core 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: pymechanical-v${{ env.VERSION_MEILI }} + host-url: ${{ env.MEILISEARCH_HOST_URL }} + api-key: ${{ env.MEILISEARCH_API_KEY }} + python-version: ${{ env.MAIN_PYTHON_VERSION }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 231fe67ea..2e036a076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG](https://kee - Add codeql.yml for security checks ([#423](https://github.com/ansys/pymechanical/pull/423)) - add readonly flag and assertion ([#441](https://github.com/ansys/pymechanical/pull/441)) +- Add PyMeilisearch in documentation ([#508](https://github.com/ansys/pymechanical/pull/508)) ### Fixed diff --git a/doc/source/conf.py b/doc/source/conf.py index 8abe71ef7..7a5fd7c1b 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -171,7 +171,6 @@ "thumbnail_size": (350, 350), } - # -- Options for HTML output ------------------------------------------------- html_short_title = html_title = "PyMechanical" html_theme = "ansys_sphinx_theme" @@ -204,6 +203,12 @@ "icon": "fa fa-comment fa-fw", }, ], + "use_meilisearch": { + "api_key": os.getenv("MEILISEARCH_PUBLIC_API_KEY", ""), + "index_uids": { + f"pymemchanical-v{get_version_match(version).replace('.', '-')}": "PyMechanical", + }, + }, } # -- Options for HTMLHelp output ---------------------------------------------