diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index ad28fc8d4..fb485d858 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -11,6 +11,7 @@ on: env: MAIN_PYTHON_VERSION: '3.7' DOC_PYTHON_VERSION: '3.9' + DOCUMENTATION_CNAME: 'rep.docs.pyansys.com' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -37,7 +38,7 @@ jobs: name: Quick tests and coverage runs-on: ${{ matrix.os }} strategy: - # max 1 job at a time running against the server to make it more robust + # max 1 job at a time running against the server to make it more robust max-parallel: 1 matrix: os: [ubuntu-latest] @@ -84,7 +85,7 @@ jobs: working-directory: ./rep-deployments/docker-compose - name: Test with tox - run: tox -e ${{ matrix.cfg.toxenv }}-noeval-coverage + run: tox -e ${{ matrix.cfg.toxenv }}-noeval-coverage env: REP_TEST_URL: https://localhost:8443/rep REP_TEST_USERNAME: repadmin @@ -95,7 +96,7 @@ jobs: if: always() with: report_paths: '**/test*.xml' - check_name: Test Report ${{ matrix.os }}:${{ matrix.cfg.python-version }} + check_name: Test Report ${{ matrix.os }}:${{ matrix.cfg.python-version }} docs: name: Documentation @@ -112,17 +113,24 @@ jobs: python -m pip install --upgrade pip setuptools tox - name: Generate the documentation with tox run: tox -e doc - - name: Add gh-pages parameters - run: | - touch build/sphinx/html/.nojekyll - echo "dev.rep.docs.pyansys.com" >> build/sphinx/html/CNAME - - name: Deploy Documentation - if: github.ref == 'refs/heads/main' - uses: JamesIves/github-pages-deploy-action@4.1.4 + - name: Upload HTML Documentation + uses: actions/upload-artifact@v2 + with: + name: documentation-html + path: build/sphinx/html + retention-days: 7 + + upload_dev_docs: + name: "Upload dev documentation" + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: [docs] + steps: + - name: Deploy the latest documentation + uses: pyansys/actions/doc-deploy-dev@v2 with: - branch: gh-pages - folder: build/sphinx/html - clean: true + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} build: name: Build and publish library diff --git a/doc/source/conf.py b/doc/source/conf.py index c4cd4e836..a59642354 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -3,6 +3,7 @@ import os import sys +from ansys_sphinx_theme import get_version_match from ansys_sphinx_theme import pyansys_logo_black as logo from ansys.rep.client import __company__, __external_version__, __version__, __version_no_dots__ @@ -16,6 +17,9 @@ copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved" author = __company__ +cname = os.getenv("DOCUMENTATION_CNAME", "rep.docs.pyansys.com") +"""The canonical name of the webpage hosting the documentation.""" + # The short X.Y version release = version = __version__ @@ -123,6 +127,11 @@ ], "collapse_navigation": True, "navigation_depth": 4, + "switcher": { + "json_url": f"https://{cname}/release/versions.json", + "version_match": get_version_match(__version__), + }, + "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], } # A shorter title for the navigation bar. Default is the same as html_title.