Skip to content

Commit

Permalink
doc: enhance search bar experience by using pymeilisearch (#1179)
Browse files Browse the repository at this point in the history
* feat: add meilisearch indexing

* fix: Update docs/source/conf.py

* fix: env variable

* fix: indentation

* fix: the version

* fix: the version
  • Loading branch information
Revathyvenugopal162 authored Oct 13, 2023
1 parent 5ee39a2 commit d7a6272
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -135,6 +137,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
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -63,3 +65,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: "Install the package requirements"
run: pip install -e .

- name: "Get the version to PyMeilisearch"
run: |
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
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
7 changes: 7 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('.', '-')}": "PyDPF-Core",
},
},
}



# 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".
Expand Down

0 comments on commit d7a6272

Please sign in to comment.