From 2feae96cd548fe85dcc54bd6855d35c589f40300 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 23 Nov 2022 16:05:27 +0100 Subject: [PATCH 01/13] Add default position for version switcher --- src/ansys_sphinx_theme/_templates/version-switcher.html | 5 +++++ src/ansys_sphinx_theme/theme.conf | 1 + 2 files changed, 6 insertions(+) create mode 100644 src/ansys_sphinx_theme/_templates/version-switcher.html diff --git a/src/ansys_sphinx_theme/_templates/version-switcher.html b/src/ansys_sphinx_theme/_templates/version-switcher.html new file mode 100644 index 00000000..60ef2a7d --- /dev/null +++ b/src/ansys_sphinx_theme/_templates/version-switcher.html @@ -0,0 +1,5 @@ +{%- extends "pydata_sphinx_theme/components/version-switcher.html" -%} + +{{ super() }} + + diff --git a/src/ansys_sphinx_theme/theme.conf b/src/ansys_sphinx_theme/theme.conf index f7bb8115..dd680e84 100644 --- a/src/ansys_sphinx_theme/theme.conf +++ b/src/ansys_sphinx_theme/theme.conf @@ -11,3 +11,4 @@ show_icons = True hidden_icons = additional_breadcrumbs = switcher = +navbar_end = version-switcher.html, theme-switcher.html, navbar-icon-links.html \ No newline at end of file From a3260617279fe0cf9f14db76f8f718b0ba0f4033 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 23 Nov 2022 16:22:06 +0100 Subject: [PATCH 02/13] use pyansys actions --- .github/workflows/ci_cd.yml | 104 +++++++++++++----------------------- 1 file changed, 37 insertions(+), 67 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index ca470d8c..339bb547 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -7,90 +7,60 @@ on: - "*" branches: - main +env: + MAIN_PYTHON_VERSION : '3.10' + pyansys-actions: 'pyansys/actions/.github/workflows' + cname: 'sphinxdocs.ansys.com' jobs: - style: + code-style: name: Code style runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - name: Install dependencies - run: | - python -m pip install --upgrade pip tox - - name: Test with tox - run: tox -e style + - name: "Run PyAnsys code style checks" + uses: pyansys/actions/code-style@main - docs-style: - name: Documentation Style Check + doc-style: + name: Doc style runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Running Vale - uses: errata-ai/vale-action@reviewdog - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: "Run Ansys documentation style checks" + uses: pyansys/actions/doc-style@main with: - files: doc - reporter: github-pr-check - level: error - filter_mode: nofilter - fail_on_error: true - vale_flags: "--config=doc/.vale.ini" + token: ${{ secrets.GITHUB_TOKEN }} - docs: - name: Documentation + doc-build: + name: Doc building runs-on: ubuntu-latest - needs: docs-style + needs: doc-style steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.9 + - name: "Run Ansys documentation building action" + uses: pyansys/actions/doc-build@main - - name: Install dependencies - run: | - sudo apt update - sudo apt-get install -y build-essential zip pandoc texlive-latex-extra latexmk texlive-pstricks - python -m pip install --upgrade pip tox - python -m pip install -r requirements/requirements_doc.txt - python -m pip install --editable . - - name: Build HTML documentation - run: tox -e doc - - - name: Upload HTML Documentation - uses: actions/upload-artifact@v3.1.1 - with: - name: HTML-Documentation - path: .tox/doc_out/ - retention-days: 7 - - - name: Build PDF Documentation - run: | - make -C doc pdf - - name: Upload PDF Documentation - uses: actions/upload-artifact@v3.1.1 + doc-deploy-development: + name: Doc dev version deploy + if: github.event_name == 'push' + runs-on: ubuntu-latest + needs: doc-build + steps: + - name: "Deploy developers documentation" + uses: pyansys/actions/doc-deploy-dev@main with: - name: PDF-Documentation - path: doc/build/latex/ansys_sphinx_theme.pdf - retention-days: 7 + cname: ${{ env.cname }} + token: ${{ secrets.GITHUB_TOKEN }} - - name: Deploy to gh-pages - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - uses: JamesIves/github-pages-deploy-action@v4.4.1 + doc-deploy-stable: + name: Doc stable version deploy + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + runs-on: ubuntu-latest + needs: doc-deploy-development + steps: + - name: "Deploy stable documentation" + uses: pyansys/actions/doc-deploy-stable@main with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages - FOLDER: .tox/doc_out/ - CLEAN: true - SINGLE_COMMIT: true + cname: ${{ env.cname }} + token: ${{ secrets.GITHUB_TOKEN }} build: name: Build From 1e1d14cdcc94b1cf1f401498d08038fb67124366 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 23 Nov 2022 16:24:34 +0100 Subject: [PATCH 03/13] change the workflow name --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 339bb547..809f5aef 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -65,7 +65,7 @@ jobs: build: name: Build runs-on: ubuntu-latest - needs: style + needs: [doc-deploy-stable, code-style] steps: - uses: actions/checkout@v3 - name: Set up Python From c7e789f4766a3c16468ca83dc5c60378e62b7c26 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 23 Nov 2022 16:31:36 +0100 Subject: [PATCH 04/13] change the workflow names --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 809f5aef..32a3b210 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -89,7 +89,7 @@ jobs: release: name: Release if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - needs: [style, docs-style, docs, build] + needs: build runs-on: ubuntu-latest steps: From 862d40f00c4330e1ded827f945d891d59e5c79e8 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 23 Nov 2022 16:42:50 +0100 Subject: [PATCH 05/13] Add version in conf --- doc/source/conf.py | 13 +++++++++++++ src/ansys_sphinx_theme/theme.conf | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index b875e05e..2855ceb2 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -22,6 +22,15 @@ author = "Ansys Inc." release = version = __version__ + +def get_version_match(semver): + """Evaluate the version match for the multi-documentation.""" + if semver.endswith("dev0"): + return "dev" + major, minor, _ = semver.split(".") + return ".".join([major, minor]) + + # use the default ansys logo html_logo = ansys_logo_black html_theme = "ansys_sphinx_theme" @@ -38,6 +47,10 @@ "github_url": "https://github.com/ansys/ansys-sphinx-theme", "use_edit_page_button": True, "contact_mail": "pyansys.support@ansys.com", + "switcher": { + "json_url": "https://raw.githubusercontent.com/ansys/ansys-templates/gh-pages/release/versions.json", # noqa: E501 + "version_match": get_version_match(__version__), + }, "additional_breadcrumbs": [ ("Ansys Internal Developer Portal", "https://dev.docs.ansys.com"), ], diff --git a/src/ansys_sphinx_theme/theme.conf b/src/ansys_sphinx_theme/theme.conf index dd680e84..2e5e2b51 100644 --- a/src/ansys_sphinx_theme/theme.conf +++ b/src/ansys_sphinx_theme/theme.conf @@ -11,4 +11,4 @@ show_icons = True hidden_icons = additional_breadcrumbs = switcher = -navbar_end = version-switcher.html, theme-switcher.html, navbar-icon-links.html \ No newline at end of file +navbar_end = version-switcher.html, theme-switcher.html, navbar-icon-links.html \ No newline at end of file From 1d0a0725cde5583a3108f773d3ecffe593caa412 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 23 Nov 2022 16:44:52 +0100 Subject: [PATCH 06/13] Change lib name --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 2855ceb2..5f4e421f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -48,7 +48,7 @@ def get_version_match(semver): "use_edit_page_button": True, "contact_mail": "pyansys.support@ansys.com", "switcher": { - "json_url": "https://raw.githubusercontent.com/ansys/ansys-templates/gh-pages/release/versions.json", # noqa: E501 + "json_url": "https://raw.githubusercontent.com/ansys/ansys-sphinx-theme/gh-pages/release/versions.json", # noqa: E501 "version_match": get_version_match(__version__), }, "additional_breadcrumbs": [ From 9933563c754e877791d7632ece1e3a92f3aea535 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 23 Nov 2022 16:54:23 +0100 Subject: [PATCH 07/13] Add queue for build --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 32a3b210..7a78d6c6 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -65,7 +65,7 @@ jobs: build: name: Build runs-on: ubuntu-latest - needs: [doc-deploy-stable, code-style] + needs: [code-style] steps: - uses: actions/checkout@v3 - name: Set up Python From a72f6d5f2e8d0349fac6fcc3d09871c73c263af9 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 24 Nov 2022 11:57:01 +0100 Subject: [PATCH 08/13] add version match fn in theme --- doc/source/conf.py | 10 +--------- src/ansys_sphinx_theme/__init__.py | 9 ++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 5f4e421f..9384d90f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -12,6 +12,7 @@ ansys_logo_white, ansys_logo_white_cropped, generate_404, + get_version_match, latex, watermark, ) @@ -22,15 +23,6 @@ author = "Ansys Inc." release = version = __version__ - -def get_version_match(semver): - """Evaluate the version match for the multi-documentation.""" - if semver.endswith("dev0"): - return "dev" - major, minor, _ = semver.split(".") - return ".".join([major, minor]) - - # use the default ansys logo html_logo = ansys_logo_black html_theme = "ansys_sphinx_theme" diff --git a/src/ansys_sphinx_theme/__init__.py b/src/ansys_sphinx_theme/__init__.py index 7f221e7b..71b887ee 100644 --- a/src/ansys_sphinx_theme/__init__.py +++ b/src/ansys_sphinx_theme/__init__.py @@ -22,7 +22,6 @@ page_404 = os.path.join(_this_path, "static", "404.rst") html_logo = pyansys_logo_black - CSS_FILENAME = "ansys_sphinx_theme.css" @@ -31,6 +30,14 @@ def get_html_theme_path(): return Path(__file__).parents[0].absolute() +def get_version_match(semver): + """Evaluate the version match for the multi-documentation.""" + if semver.endswith("dev0"): + return "dev" + major, minor, _ = semver.split(".") + return ".".join([major, minor]) + + def setup(app): """Connect to the sphinx theme app.""" theme_path = get_html_theme_path() From 18f310a7db1e739475dbd1276fd83c660e909ff4 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 24 Nov 2022 14:43:51 +0100 Subject: [PATCH 09/13] Add context --- src/ansys_sphinx_theme/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ansys_sphinx_theme/__init__.py b/src/ansys_sphinx_theme/__init__.py index 71b887ee..91d80fbd 100644 --- a/src/ansys_sphinx_theme/__init__.py +++ b/src/ansys_sphinx_theme/__init__.py @@ -38,6 +38,22 @@ def get_version_match(semver): return ".".join([major, minor]) +def prepare_html_configration(app, pagename, templatename, theme_options, doctree): + """Prepare some configuration values for the HTML build. + + For some reason (in most of repo) switcher might not be there, so we manually adding in that + case. + """ + theme_switcher = theme_options.get("switcher") + if not theme_switcher or theme_switcher is None: + theme_switcher = {"version_match": "dev-stable"} + + if not isinstance(theme_switcher, dict): + raise ValueError(f"Incorrect switcher config type: {type(theme_switcher)}") + + theme_options["theme_switcher"] = theme_switcher + + def setup(app): """Connect to the sphinx theme app.""" theme_path = get_html_theme_path() @@ -50,6 +66,7 @@ def setup(app): # add templates for autosummary path_templates = os.path.join(_this_path, "_templates") app.config.templates_path.append(path_templates) + app.connect("html-page-context", prepare_html_configration) return { "version": __version__, From fee7e0711db2def3f3fdee8fbd5095b89d143e4e Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 24 Nov 2022 15:08:58 +0100 Subject: [PATCH 10/13] give default version to the switcher --- doc/source/conf.py | 5 ----- src/ansys_sphinx_theme/__init__.py | 15 +++++++-------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 9384d90f..b875e05e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -12,7 +12,6 @@ ansys_logo_white, ansys_logo_white_cropped, generate_404, - get_version_match, latex, watermark, ) @@ -39,10 +38,6 @@ "github_url": "https://github.com/ansys/ansys-sphinx-theme", "use_edit_page_button": True, "contact_mail": "pyansys.support@ansys.com", - "switcher": { - "json_url": "https://raw.githubusercontent.com/ansys/ansys-sphinx-theme/gh-pages/release/versions.json", # noqa: E501 - "version_match": get_version_match(__version__), - }, "additional_breadcrumbs": [ ("Ansys Internal Developer Portal", "https://dev.docs.ansys.com"), ], diff --git a/src/ansys_sphinx_theme/__init__.py b/src/ansys_sphinx_theme/__init__.py index 91d80fbd..93bfc029 100644 --- a/src/ansys_sphinx_theme/__init__.py +++ b/src/ansys_sphinx_theme/__init__.py @@ -38,20 +38,19 @@ def get_version_match(semver): return ".".join([major, minor]) -def prepare_html_configration(app, pagename, templatename, theme_options, doctree): +def prepare_html_configration(app, pagename, templatename, context, doctree): """Prepare some configuration values for the HTML build. For some reason (in most of repo) switcher might not be there, so we manually adding in that case. """ - theme_switcher = theme_options.get("switcher") - if not theme_switcher or theme_switcher is None: - theme_switcher = {"version_match": "dev-stable"} + theme_switcher = context.get("switcher") + if not theme_switcher: + theme_switcher = { + "version_match": get_version_match(__version__), + } - if not isinstance(theme_switcher, dict): - raise ValueError(f"Incorrect switcher config type: {type(theme_switcher)}") - - theme_options["theme_switcher"] = theme_switcher + context["theme_switcher"] = theme_switcher def setup(app): From feb955e434fb0c13022c8492c29436d997cb3408 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 24 Nov 2022 17:38:59 +0100 Subject: [PATCH 11/13] Update init file --- src/ansys_sphinx_theme/__init__.py | 16 ---------------- src/ansys_sphinx_theme/theme.conf | 3 +-- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/ansys_sphinx_theme/__init__.py b/src/ansys_sphinx_theme/__init__.py index 93bfc029..71b887ee 100644 --- a/src/ansys_sphinx_theme/__init__.py +++ b/src/ansys_sphinx_theme/__init__.py @@ -38,21 +38,6 @@ def get_version_match(semver): return ".".join([major, minor]) -def prepare_html_configration(app, pagename, templatename, context, doctree): - """Prepare some configuration values for the HTML build. - - For some reason (in most of repo) switcher might not be there, so we manually adding in that - case. - """ - theme_switcher = context.get("switcher") - if not theme_switcher: - theme_switcher = { - "version_match": get_version_match(__version__), - } - - context["theme_switcher"] = theme_switcher - - def setup(app): """Connect to the sphinx theme app.""" theme_path = get_html_theme_path() @@ -65,7 +50,6 @@ def setup(app): # add templates for autosummary path_templates = os.path.join(_this_path, "_templates") app.config.templates_path.append(path_templates) - app.connect("html-page-context", prepare_html_configration) return { "version": __version__, diff --git a/src/ansys_sphinx_theme/theme.conf b/src/ansys_sphinx_theme/theme.conf index 2e5e2b51..069fe209 100644 --- a/src/ansys_sphinx_theme/theme.conf +++ b/src/ansys_sphinx_theme/theme.conf @@ -10,5 +10,4 @@ show_breadcrumbs = True show_icons = True hidden_icons = additional_breadcrumbs = -switcher = -navbar_end = version-switcher.html, theme-switcher.html, navbar-icon-links.html \ No newline at end of file +switcher = \ No newline at end of file From 19f0f8baa3cf07821c2d79b01f267c94ef45737e Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 24 Nov 2022 17:41:19 +0100 Subject: [PATCH 12/13] delete version html file --- src/ansys_sphinx_theme/_templates/version-switcher.html | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/ansys_sphinx_theme/_templates/version-switcher.html diff --git a/src/ansys_sphinx_theme/_templates/version-switcher.html b/src/ansys_sphinx_theme/_templates/version-switcher.html deleted file mode 100644 index 60ef2a7d..00000000 --- a/src/ansys_sphinx_theme/_templates/version-switcher.html +++ /dev/null @@ -1,5 +0,0 @@ -{%- extends "pydata_sphinx_theme/components/version-switcher.html" -%} - -{{ super() }} - - From fb18986c7ffd3da70d88059b912e780ee4fa298b Mon Sep 17 00:00:00 2001 From: Jorge Martinez Garrido Date: Thu, 24 Nov 2022 17:57:04 +0100 Subject: [PATCH 13/13] CI: update workflows --- .github/workflows/ci_cd.yml | 98 +++++++++++++++---------------------- doc/source/conf.py | 9 ++++ 2 files changed, 49 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 7a78d6c6..c66354a9 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -9,8 +9,9 @@ on: - main env: MAIN_PYTHON_VERSION : '3.10' - pyansys-actions: 'pyansys/actions/.github/workflows' - cname: 'sphinxdocs.ansys.com' + PACKAGE_NAME: 'ansys-sphinx-theme' + PACKAGE_NAMESPACE: 'ansys_sphinx_theme' + DOCUMENTATION_CNAME: 'sphinxdocs.ansys.com' jobs: @@ -19,14 +20,16 @@ jobs: runs-on: ubuntu-latest steps: - name: "Run PyAnsys code style checks" - uses: pyansys/actions/code-style@main + uses: pyansys/actions/code-style@v1 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} doc-style: name: Doc style runs-on: ubuntu-latest steps: - name: "Run Ansys documentation style checks" - uses: pyansys/actions/doc-style@main + uses: pyansys/actions/doc-style@v1 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -36,7 +39,9 @@ jobs: needs: doc-style steps: - name: "Run Ansys documentation building action" - uses: pyansys/actions/doc-build@main + uses: pyansys/actions/doc-build@v1 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} doc-deploy-development: name: Doc dev version deploy @@ -45,9 +50,9 @@ jobs: needs: doc-build steps: - name: "Deploy developers documentation" - uses: pyansys/actions/doc-deploy-dev@main + uses: pyansys/actions/doc-deploy-dev@v1 with: - cname: ${{ env.cname }} + cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} doc-deploy-stable: @@ -57,67 +62,44 @@ jobs: needs: doc-deploy-development steps: - name: "Deploy stable documentation" - uses: pyansys/actions/doc-deploy-stable@main + uses: pyansys/actions/doc-deploy-stable@v1 with: - cname: ${{ env.cname }} - token: ${{ secrets.GITHUB_TOKEN }} + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} + python-version: ${{ env.MAIN_PYTHON_VERSION }} - build: - name: Build + build-library: + name: "Build library" runs-on: ubuntu-latest - needs: [code-style] + needs: doc-deploy-stable steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 + - name: "Build library source and wheel artifacts" + uses: pyansys/actions/build-library@v1 with: - python-version: 3.9 - - name: Install dependencies - run: | - python -m pip install --upgrade pip pipx - python -m pip install -r requirements/requirements_build.txt - - name: Build wheel and sdist - run: | - python -m build && python -m twine check dist/* - - name: Upload wheel and sdist to artifacts - uses: actions/upload-artifact@v3.1.1 - with: - name: ansys-sphinx-theme - path: dist/ - retention-days: 7 + library-name: ${{ env.PACKAGE_NAME }} release: - name: Release + name: "Release project to private PyPI, public PyPI and GitHub" if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - needs: build + needs: build-library runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v3 - - name: Set up Python - uses: actions/setup-python@v4 + + - name: "Release to the private PyPI repository" + uses: pyansys/actions/release-pypi-private@v1 with: - python-version: 3.9 - - name: Display structure of downloaded files - run: ls -R - - name: Install dependencies - run: | - python -m pip install --upgrade pip twine - - name: Publish to PyPI - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - python -m twine upload --skip-existing ./**/*.whl - python -m twine upload --skip-existing ./**/*.tar.gz - - name: Publish to GitHub - uses: softprops/action-gh-release@v1 + library-name: ${{ env.PACKAGE_NAME }} + twine-username: "__token__" + twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} + + - name: "Release to the public PyPI repository" + uses: pyansys/actions/release-pypi-public@v1 with: - files: | - ./**/*.whl - ./**/*.tar.gz - ./PDF-Documentation/ansys_sphinx_theme.pdf - - name: Release - uses: softprops/action-gh-release@v1 + library-name: ${{ env.PACKAGE_NAME }} + twine-username: "__token__" + twine-token: ${{ secrets.PYPI_TOKEN }} + + - name: "Release to GitHub" + uses: pyansys/actions/release-github@v1 with: - generate_release_notes: true + library-name: ${{ env.PACKAGE_NAME }} diff --git a/doc/source/conf.py b/doc/source/conf.py index b875e05e..820de8e9 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,5 +1,7 @@ """Sphinx documentation configuration file.""" + from datetime import datetime +import os from sphinx.builders.latex import LaTeXBuilder @@ -12,6 +14,7 @@ ansys_logo_white, ansys_logo_white_cropped, generate_404, + get_version_match, latex, watermark, ) @@ -21,6 +24,7 @@ copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved" author = "Ansys Inc." release = version = __version__ +cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com") # use the default ansys logo html_logo = ansys_logo_black @@ -47,6 +51,11 @@ "name": "Changelog", }, ], + "switcher": { + "json_url": f"https://{cname}/release/versions.json", + "version_match": get_version_match(__version__), + }, + "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], } html_short_title = html_title = "Ansys Sphinx Theme"