Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the meilisearch index #334

Merged
merged 4 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
17 changes: 16 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down
Loading