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

Enable multi version docs #274

Merged
merged 7 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
41 changes: 20 additions & 21 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
- 'pyproject.toml'
workflow_dispatch:

env:
DOCUMENTATION_CNAME: 'bomanalytics.grantami.docs.pyansys.com'

jobs:
local_checks:
Expand All @@ -36,9 +38,21 @@ jobs:
TEST_SERVER_READ_USER: ${{ secrets.TEST_SERVER_READ_USER }}
TEST_SERVER_READ_PASS: ${{ secrets.TEST_SERVER_READ_PASS }}

doc-deploy-dev:
name: "Deploy development documentation"
runs-on: ubuntu-latest
needs: [ integration_checks ]
if: github.event_name == 'push'
steps:
- uses: pyansys/actions/doc-deploy-dev@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: Documentation-html

Release:
if: contains(github.ref, 'refs/tags') && github.event_name == 'push'
needs: integration_checks
needs: doc-deploy-dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -48,14 +62,6 @@ jobs:
with:
python-version: '3.9'

# used for documentation deployment
- name: Get Bot Application Token
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 }}

- uses: actions/download-artifact@v3
with:
name: ansys-grantami-bomanalytics-wheel
Expand All @@ -65,19 +71,12 @@ jobs:
with:
name: Documentation-pdf

- uses: actions/download-artifact@v3
with:
name: Documentation-html
path: ~/html

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.4.1
- name: "Deploy stable documentation"
uses: pyansys/actions/doc-deploy-stable@v4
with:
repository-name: pyansys/grantami-bomanalytics-docs
token: ${{ steps.get_workflow_token.outputs.token }}
BRANCH: gh-pages
FOLDER: ~/html
CLEAN: true
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: Documentation-html

# note how we use the PyPI tokens
- name: Upload to PyPI
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/server_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,40 +117,6 @@ jobs:
- name: Build PDF Documentation
run: make -C doc latexpdf

- name: Build json documentation
run: |
# Export the documentation files to JSON files.
poetry run sphinx-build -M json doc/source doc-json -j auto -w build_errors.txt -N;
env:
TEST_SL_URL: ${{secrets.TEST_SERVER_URL}}
TEST_USER: ${{secrets.TEST_SERVER_READ_USER}}
TEST_PASS: ${{secrets.TEST_SERVER_READ_PASS}}
BUILD_EXAMPLES: 1

- name: Flatten the generated nested files into a single directory
run: |
echo Flattening a nested directory
mkdir doc-flatten-json;
echo Move all the JSON file to the flatten directory.
find . -name "*.fjson" -exec mv "{}" --backup=numbered ./doc-flatten-json \;
echo Make sure all the file has .json extensions instead of the .fjson
for file in doc-flatten-json/*.fjson ; do mv -- "$file" "${file%.fjson}.json" ; done;

- name: zip the flattened JSON directory
run: |
zip -r grantami-bomanalytics-doc-flatten-json.zip doc-flatten-json;
mkdir grantami-bomanalytics-doc-flatten-json;
mv grantami-bomanalytics-doc-flatten-json.zip grantami-bomanalytics-doc-flatten-json;
echo "Clean up build directories after the process is completed."
rm -rf doc-json doc-flatten-json;

- name: Upload json Documentation
uses: actions/upload-artifact@v3
with:
name: grantami-bomanalytics-doc-flatten-json.zip
path: grantami-bomanalytics-doc-flatten-json
retention-days: 7

- name: Upload HTML Documentation
uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Alternatively, clone and install this package with this code:

Documentation
-------------
The `Granta MI BoM Analytics Documentation <https://grantami.docs.pyansys.com>`_
The `Granta MI BoM Analytics Documentation <https://bomanalytics.grantami.docs.pyansys.com>`_
provides comprehensive installation and usage information.


Expand Down Expand Up @@ -64,7 +64,7 @@ Here's a brief example of how to use Granta MI BoM Analytics:

Testing
-------
For information on testing, see `Contributing <https://grantami.docs.pyansys.com/contributing>`_.
For information on testing, see the ``Contributing`` section of the documentation.


License
Expand Down
9 changes: 0 additions & 9 deletions doc/source/_templates/sidebar-nav-bs.html

This file was deleted.

14 changes: 12 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import os
from datetime import datetime
from ansys_sphinx_theme import pyansys_logo_black
from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black
import shutil
from pathlib import Path
import jupytext
Expand Down Expand Up @@ -128,12 +128,22 @@


# -- Options for HTML output -------------------------------------------------
cname = os.getenv("DOCUMENTATION_CNAME", "bomanalytics.grantami.docs.pyansys.com")
"""The canonical name of the webpage hosting the documentation."""
html_theme = "ansys_sphinx_theme"
html_favicon = ansys_favicon
html_logo = pyansys_logo_black
html_theme_options = {
"github_url": "https://github.com/pyansys/grantami-bomanalytics",
"additional_breadcrumbs": [("PyAnsys Documentation", "https://docs.pyansys.com/")],
"additional_breadcrumbs": [
("PyAnsys Documentation", "https://docs.pyansys.com/"),
("Granta MI", "https://grantami.docs.pyansys.com/"),
],
"show_breadcrumbs": True,
"switcher": {
"json_url": f"https://{cname}/versions.json",
"version_match": get_version_match(__version__),
},
}

# -- Options for HTMLHelp output ---------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ To reach the PyAnsys support team, email `pyansys.support@ansys.com <pyansys.sup
View Granta MI BoM Analytics documentation
------------------------------------------
Documentation for the latest stable release of Granta MI BoM Analytics
is hosted at `Granta MI BoM Analytics Documentation <https://grantami.docs.pyansys.com>`_.
is hosted at `Granta MI BoM Analytics Documentation <https://bomanalytics.grantami.docs.pyansys.com>`_.

View examples
-------------
Expand Down
Loading