Skip to content

Commit

Permalink
CI: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgepiloto committed Nov 24, 2022
1 parent 19f0f8b commit fb18986
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 58 deletions.
98 changes: 40 additions & 58 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ on:
- main
env:
MAIN_PYTHON_VERSION : '3.10'
pyansys-actions: 'pyansys/actions/.github/workflows'
cname: 'sphinxdocs.ansys.com'
PACKAGE_NAME: 'ansys-sphinx-theme'
PACKAGE_NAMESPACE: 'ansys_sphinx_theme'
DOCUMENTATION_CNAME: 'sphinxdocs.ansys.com'

jobs:

Expand All @@ -19,14 +20,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Run PyAnsys code style checks"
uses: pyansys/actions/code-style@main
uses: pyansys/actions/code-style@v1
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

doc-style:
name: Doc style
runs-on: ubuntu-latest
steps:
- name: "Run Ansys documentation style checks"
uses: pyansys/actions/doc-style@main
uses: pyansys/actions/doc-style@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -36,7 +39,9 @@ jobs:
needs: doc-style
steps:
- name: "Run Ansys documentation building action"
uses: pyansys/actions/doc-build@main
uses: pyansys/actions/doc-build@v1
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

doc-deploy-development:
name: Doc dev version deploy
Expand All @@ -45,9 +50,9 @@ jobs:
needs: doc-build
steps:
- name: "Deploy developers documentation"
uses: pyansys/actions/doc-deploy-dev@main
uses: pyansys/actions/doc-deploy-dev@v1
with:
cname: ${{ env.cname }}
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}

doc-deploy-stable:
Expand All @@ -57,67 +62,44 @@ jobs:
needs: doc-deploy-development
steps:
- name: "Deploy stable documentation"
uses: pyansys/actions/doc-deploy-stable@main
uses: pyansys/actions/doc-deploy-stable@v1
with:
cname: ${{ env.cname }}
token: ${{ secrets.GITHUB_TOKEN }}
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}

build:
name: Build
build-library:
name: "Build library"
runs-on: ubuntu-latest
needs: [code-style]
needs: doc-deploy-stable
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- name: "Build library source and wheel artifacts"
uses: pyansys/actions/build-library@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip pipx
python -m pip install -r requirements/requirements_build.txt
- name: Build wheel and sdist
run: |
python -m build && python -m twine check dist/*
- name: Upload wheel and sdist to artifacts
uses: actions/[email protected]
with:
name: ansys-sphinx-theme
path: dist/
retention-days: 7
library-name: ${{ env.PACKAGE_NAME }}

release:
name: Release
name: "Release project to private PyPI, public PyPI and GitHub"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: build
needs: build-library
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v3
- name: Set up Python
uses: actions/setup-python@v4

- name: "Release to the private PyPI repository"
uses: pyansys/actions/release-pypi-private@v1
with:
python-version: 3.9
- name: Display structure of downloaded files
run: ls -R
- name: Install dependencies
run: |
python -m pip install --upgrade pip twine
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m twine upload --skip-existing ./**/*.whl
python -m twine upload --skip-existing ./**/*.tar.gz
- name: Publish to GitHub
uses: softprops/action-gh-release@v1
library-name: ${{ env.PACKAGE_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}

- name: "Release to the public PyPI repository"
uses: pyansys/actions/release-pypi-public@v1
with:
files: |
./**/*.whl
./**/*.tar.gz
./PDF-Documentation/ansys_sphinx_theme.pdf
- name: Release
uses: softprops/action-gh-release@v1
library-name: ${{ env.PACKAGE_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}

- name: "Release to GitHub"
uses: pyansys/actions/release-github@v1
with:
generate_release_notes: true
library-name: ${{ env.PACKAGE_NAME }}
9 changes: 9 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Sphinx documentation configuration file."""

from datetime import datetime
import os

from sphinx.builders.latex import LaTeXBuilder

Expand All @@ -12,6 +14,7 @@
ansys_logo_white,
ansys_logo_white_cropped,
generate_404,
get_version_match,
latex,
watermark,
)
Expand All @@ -21,6 +24,7 @@
copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved"
author = "Ansys Inc."
release = version = __version__
cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com")

# use the default ansys logo
html_logo = ansys_logo_black
Expand All @@ -47,6 +51,11 @@
"name": "Changelog",
},
],
"switcher": {
"json_url": f"https://{cname}/release/versions.json",
"version_match": get_version_match(__version__),
},
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
}

html_short_title = html_title = "Ansys Sphinx Theme"
Expand Down

0 comments on commit fb18986

Please sign in to comment.