diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91cfa9cee17..0b3540547ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ env: # It applies 7 days retention policy by default. RESET_EXAMPLES_CACHE: 6 API_CODE_CACHE: 3 + DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com' jobs: stylecheck: @@ -116,15 +117,6 @@ jobs: steps: - uses: actions/checkout@v3 - # used for documentation deployment - - name: Get Bot Application Token - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') && matrix.image-tag == 'v23.1.0' - id: get_workflow_token - uses: peter-murray/workflow-application-token-action@v2 - with: - application_id: ${{ secrets.BOT_APPLICATION_ID }} - application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }} - - name: Setup Python uses: actions/setup-python@v4 with: @@ -206,17 +198,12 @@ jobs: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ matrix.image-tag }} - name: Build Documentation - run: make build-doc DOCS_CNAME=fluent.docs.pyansys.com + run: make build-doc env: ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} PYFLUENT_START_INSTANCE: 0 FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} - - name: Zip HTML Documentation before upload - run: | - sudo apt install zip -y - zip -r doc.zip doc/_build/html - - name: Upload HTML Documentation if: matrix.image-tag == 'v23.1.0' uses: actions/upload-artifact@v3 @@ -225,15 +212,14 @@ jobs: path: doc.zip retention-days: 7 - - name: Deploy + - name: Deploy stable documentation + uses: pyansys/actions/doc-deploy-stable@v2 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'dev') && matrix.image-tag == 'v23.1.0' - uses: JamesIves/github-pages-deploy-action@v4.4.1 with: - repository-name: pyansys/pyfluent-docs - token: ${{ secrets.DOC_DEPLOYMENT_PAT }} - BRANCH: gh-pages - FOLDER: doc/_build/html - CLEAN: true + doc-artifact-name: 'HTML-Documentation-tag-${{ matrix.image-tag }}' + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} + build: name: Build diff --git a/.github/workflows/nightly-doc-build.yml b/.github/workflows/nightly-doc-build.yml index 823eaaad32a..b43d4343fd9 100644 --- a/.github/workflows/nightly-doc-build.yml +++ b/.github/workflows/nightly-doc-build.yml @@ -5,6 +5,9 @@ on: - cron: '0 4 * * *' workflow_dispatch: +env: + DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com' + jobs: nightly_docs_build: runs-on: [self-hosted, pyfluent] @@ -58,18 +61,22 @@ jobs: FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} - name: Build Documentation - run: make build-doc DOCS_CNAME=dev.fluent.docs.pyansys.com + run: make build-doc env: ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} PYFLUENT_START_INSTANCE: 0 FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} - - name: Deploy + - name: Upload HTML documentation if: matrix.image-tag == 'v23.1.0' - uses: JamesIves/github-pages-deploy-action@v4.4.1 + uses: actions/upload-artifact@v3 + with: + name: documentation-html + path: doc/_build/html + retention-days: 7 + + - name: "Deploy development documentation" + uses: pyansys/actions/doc-deploy-dev@v2 with: - repository-name: pyansys/pyfluent-dev-docs - token: ${{ secrets.DOC_DEPLOYMENT_PAT }} - BRANCH: gh-pages - FOLDER: doc/_build/html - CLEAN: true + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index c808ecfb0e2..ccfdd5cb81a 100644 --- a/Makefile +++ b/Makefile @@ -64,8 +64,6 @@ build-doc: @sudo rm -rf /home/ansys/.local/share/ansys_fluent_core/examples/* @pip install -r requirements/requirements_doc.txt @xvfb-run make -C doc html - @touch doc/_build/html/.nojekyll - @echo "$(DOCS_CNAME)" >> doc/_build/html/CNAME compare-flobject: @python .ci/compare_flobject.py diff --git a/doc/source/conf.py b/doc/source/conf.py index bf5978116ab..15529c3abb8 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,9 +1,10 @@ """Sphinx documentation configuration file.""" from datetime import datetime +import os import platform import subprocess -from ansys_sphinx_theme import ansys_favicon, pyansys_logo_black +from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black from sphinx_gallery.sorting import FileNameSortKey import ansys.fluent.core as pyfluent @@ -16,6 +17,7 @@ project = "ansys.fluent.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 release = version = __version__ @@ -161,6 +163,11 @@ def _stop_fluent_container(gallery_conf, fname): "additional_breadcrumbs": [ ("PyAnsys", "https://docs.pyansys.com/"), ], + "switcher": { + "json_url": f"{cname}/release/versions.json", + "version_match": get_version_match(__version__), + }, + "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], "navigation_depth": -1, } diff --git a/requirements/requirements_doc.txt b/requirements/requirements_doc.txt index abf81e79f44..e6804d96f57 100644 --- a/requirements/requirements_doc.txt +++ b/requirements/requirements_doc.txt @@ -11,4 +11,4 @@ sphinx-copybutton==0.5.1 sphinx-gallery==0.11.1 sphinx-notfound-page==0.8.3 sphinxcontrib-websupport==1.2.4 -sphinxemoji==0.2.0 \ No newline at end of file +sphinxemoji==0.2.0