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

DOC: enable multi-version documentation #694

Merged
merged 2 commits into from
Dec 16, 2022
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
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ concurrency:

env:
ANSYS_VERSION: 232
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'
MAIN_PYTHON_VERSION: '3.8'

jobs:
debug:
Expand All @@ -41,7 +43,7 @@ jobs:
- name: "Setup Python"
uses: actions/setup-python@v4.2.0
with:
python-version: 3.8
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Install style requirements"
run: |
Expand Down Expand Up @@ -83,6 +85,17 @@ jobs:
custom-requirements: ''
secrets: inherit

upload-development-docs:
runs-on: ubuntu-latest
if: startsWith(github.head_ref, 'master')
needs: [docs]
steps:
- name: "Upload development documentation"
uses: pyansys/actions/doc-deploy-dev@v2
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}

examples:
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/examples.yml
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,9 @@ jobs:
name: HTML-doc-${{env.PACKAGE_NAME}}
path: HTML-doc-${{env.PACKAGE_NAME}}.zip
if: always()

- name: "Upload HTML Documentation"
uses: actions/upload-artifact@v3
with:
name: documentation-html
path: docs/build/html
55 changes: 18 additions & 37 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,11 @@ on:
release:
types: [published]

jobs:
Deploy_Documentation:
name: "Deploy live documentation"
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@v3
env:
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'
PYTHON_MAIN_VERSION: '3.10'

- name: "Get the version"
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT

- name: "Download Release Asset - HTML"
uses: dsaltares/fetch-gh-release-asset@1.0.0
with:
file: HTML-doc-ansys-dpf-core.zip
token: ${{ secrets.GITHUB_TOKEN }}

- name: "Unzip the HMTL documentation"
uses: montudor/action-zip@v1
with:
args: unzip -qq HTML-doc-ansys-dpf-core.zip -d HTML-doc-ansys-dpf-core

- name: "Deploy to gh-pages"
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: HTML-doc-ansys-dpf-core/
token: ${{secrets.PYANSYS_CI_BOT_TOKEN}}
branch: gh-pages
git-config-name: pyansys-ci-bot
git-config-email: pyansys.github.bot@ansys.com
repository-name: pyansys/DPF-Core-docs
commit-message: Documentation generated for ${{ steps.get_version.outputs.VERSION }}
clean-exclude: "CNAME"
tag: doc-${{ steps.get_version.outputs.VERSION }}
jobs:

Publish_to_PyPI:
name: Publish to PyPI
Expand All @@ -57,4 +25,17 @@ jobs:
twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

upload_docs_release:
name: "Upload stable documentation"
needs: [Publish_to_PyPI]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: "Deploy the stable documentation"
uses: pyansys/actions/doc-deploy-stable@v2
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
8 changes: 7 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np
import pyvista
from ansys.dpf.core import __version__
from ansys_sphinx_theme import pyansys_logo_black, ansys_favicon
from ansys_sphinx_theme import pyansys_logo_black, ansys_favicon, get_version_match

# Manage errors
pyvista.set_error_output_file("errors.txt")
Expand All @@ -28,6 +28,7 @@
project = "PyDPF-Core"
copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved"
author = "ANSYS Inc."
cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com")

# The short X.Y version
version = __version__
Expand Down Expand Up @@ -162,6 +163,11 @@ def reset_servers(gallery_conf, fname, when):
"additional_breadcrumbs": [
("PyAnsys", "https://docs.pyansys.com/"),
],
"switcher": {
"json_url": f"https://{cname}/release/versions.json",
"version_match": get_version_match(__version__),
},
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
}


Expand Down