Skip to content

Commit dd4f076

Browse files
committed
Implementing multi-versioning
1 parent b108b98 commit dd4f076

File tree

3 files changed

+69
-39
lines changed

3 files changed

+69
-39
lines changed

.github/workflows/ci_cd.yml

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ env:
1313
PACKAGE_NAME: 'ansys-geometry-core'
1414
# TODO : PIP_EXTRA_INDEX_URL should be deleted once the private dependencies are removed
1515
PIP_EXTRA_INDEX_URL: 'https://${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/'
16+
PACKAGE_NAMESPACE: 'ansys.geometry.core'
17+
DOCUMENTATION_CNAME: 'geometry.docs.pyansys.com'
1618
ANSRV_GEO_IMAGE: ghcr.io/pyansys/pygeometry:latest
1719
ANSRV_GEO_PORT: 700
1820
GEO_CONT_NAME: ans_geo
@@ -212,14 +214,14 @@ jobs:
212214
- name: Upload integration test logs
213215
uses: actions/upload-artifact@v3
214216
with:
215-
name: Integration-Test-Logs
217+
name: integration-test-logs
216218
path: tests/integration/logs
217219
retention-days: 7
218220

219221
- name: Upload Coverage Results
220222
uses: actions/upload-artifact@v3
221223
with:
222-
name: HTML-Coverage
224+
name: coverage-html
223225
path: .cov/html
224226
retention-days: 7
225227

@@ -277,19 +279,37 @@ jobs:
277279
docker run --detach --name $env:GEO_CONT_NAME -p $env:ANSRV_GEO_PORT_MAP $env:ANSRV_GEO_IMAGE
278280
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
279281
280-
- name: Build the documentation
282+
- name: Build the documentation (HTML)
281283
run: |
282284
.\.venv\Scripts\Activate.ps1
283285
cd doc
284286
.\make.bat html
285287
288+
- name: Build the documentation (PDF)
289+
# run: |
290+
# .\.venv\Scripts\Activate.ps1
291+
# cd doc
292+
# .\make.bat pdf
293+
run: |
294+
cd doc/_build
295+
mkdir latex
296+
cd latex
297+
echo "" > dummy_docs.pdf
298+
286299
- name: Upload HTML documentation
287300
uses: actions/upload-artifact@v3
288301
with:
289-
name: HTML-Documentation
302+
name: documentation-html
290303
path: doc/_build/html
291304
retention-days: 7
292305

306+
- name: Upload PDF documentation
307+
uses: actions/upload-artifact@v3
308+
with:
309+
name: documentation-pdf
310+
path: doc/_build/latex/*.pdf
311+
retention-days: 7
312+
293313
- name: Stop the geometry service
294314
if: always()
295315
run: |
@@ -378,44 +398,27 @@ jobs:
378398
./**/*.tar.gz
379399
./**/*.zip
380400
381-
upload_docs_release:
382-
name: Upload documentation
383-
if: (github.event_name == 'push' && contains(github.ref, 'refs/tags')) || (github.ref == 'refs/heads/main')
401+
upload_docs_dev:
402+
name: Upload dev documentation
403+
if: github.ref == 'refs/heads/main'
384404
runs-on: ubuntu-latest
385405
needs: [package]
386406
steps:
387-
- uses: actions/checkout@v3
388-
389-
- uses: actions/download-artifact@v3
390-
with:
391-
name: HTML-Documentation
392-
path: HTML-Documentation
393-
394-
- name: Get Bot Application Token
395-
id: get_workflow_token
396-
uses: peter-murray/workflow-application-token-action@v2
407+
- name: Deploy the latest documentation
408+
uses: pyansys/actions/doc-deploy-dev@v1
397409
with:
398-
application_id: ${{ secrets.BOT_APPLICATION_ID }}
399-
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}
410+
cname: ${{ env.DOCUMENTATION_CNAME }}
411+
token: ${{ secrets.GITHUB_TOKEN }}
400412

401-
- name: Deploy documentation to pygeometry-dev-docs repository
402-
if: github.ref == 'refs/heads/main'
403-
uses: JamesIves/github-pages-deploy-action@v4.4.1
404-
with:
405-
repository-name: pyansys/pygeometry-dev-docs
406-
token: ${{ steps.get_workflow_token.outputs.token }}
407-
branch: gh-pages
408-
folder: HTML-Documentation
409-
clean: true
410-
single-commit: true
411-
412-
- name: Deploy documentation to pygeometry-docs repository
413-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
414-
uses: JamesIves/github-pages-deploy-action@v4.4.1
413+
upload_docs_release:
414+
name: Upload release documentation
415+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
416+
runs-on: ubuntu-latest
417+
needs: [release]
418+
steps:
419+
- name: Deploy the stable documentation
420+
uses: pyansys/actions/doc-deploy-stable@v1
415421
with:
416-
repository-name: pyansys/pygeometry-docs
417-
token: ${{ steps.get_workflow_token.outputs.token }}
418-
branch: gh-pages
419-
folder: HTML-Documentation
420-
clean: true
421-
single-commit: true
422+
cname: ${{ env.DOCUMENTATION_CNAME }}
423+
token: ${{ secrets.GITHUB_TOKEN }}
424+
python-version: ${{ env.MAIN_PYTHON_VERSION }}

doc/make.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set BUILDDIR=_build
1212

1313
if "%1" == "" goto help
1414
if "%1" == "clean" goto clean
15+
if "%1" == "pdf" goto pdf
1516

1617
%SPHINXBUILD% >NUL 2>NUL
1718
if errorlevel 9009 (
@@ -37,5 +38,10 @@ goto end
3738
:help
3839
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3940

41+
:pdf
42+
%SPHINXBUILD% -M lulatex %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
43+
call %BUILDDIR%/latex/make.bat
44+
goto end
45+
4046
:end
4147
popd

doc/source/conf.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
"""Sphinx documentation configuration file."""
22
from datetime import datetime
3+
import os
34

45
from ansys_sphinx_theme import ansys_favicon, pyansys_logo_black
6+
from sphinx.builders.latex import LaTeXBuilder
7+
8+
from ansys.geometry.core import __version__
9+
10+
LaTeXBuilder.supported_image_types = ["image/png", "image/pdf", "image/svg+xml"]
11+
12+
13+
def get_version_match(semver):
14+
"""Evaluate the version match for the multi-documentation."""
15+
if semver.endswith("dev0"):
16+
return "dev"
17+
major, minor, _ = semver.split(".")
18+
return ".".join([major, minor])
19+
520

621
# Project information
722
project = "ansys-geometry-core"
823
copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved"
924
author = "ANSYS, Inc."
1025
release = version = "0.1.0"
26+
cname = os.getenv("DOCUMENTATION_CNAME", default="nocname.com")
1127

1228
# Select desired logo, theme, and declare the html title
1329
html_logo = pyansys_logo_black
@@ -17,6 +33,11 @@
1733

1834
# specify the location of your github repo
1935
html_theme_options = {
36+
"switcher": {
37+
"json_url": f"https://{cname}/release/versions.json",
38+
"version_match": get_version_match(__version__),
39+
},
40+
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
2041
"github_url": "https://github.com/pyansys/pygeometry",
2142
"show_prev_next": False,
2243
"show_breadcrumbs": True,

0 commit comments

Comments
 (0)