This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
phrasing #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build documentation | |
name: Build and upload documentation | |
defaults: | |
run: | |
shell: bash | |
on: # Runs on any push event to master | |
push: | |
branches: | |
- 'master' | |
jobs: | |
documentation: | |
runs-on: ubuntu-latest | |
env: | |
python-version: 3.12 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.python-version }} | |
cache: 'pip' | |
cache-dependency-path: '**/pyproject.toml' | |
- name: Upgrade pip and setuptools | |
run: python -m pip install --upgrade pip setuptools # setuptools to have distutils, required by portray / hug | |
- name: Install package with doc dependencies | |
run: python -m pip install ".[docs]" | |
- name: Build documentation | |
run: portray as_html -o doc_build | |
# Upload artifacts if in PR so reviewers can have a quick look without building documentation from the branch locally | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
if: success() && github.event_name == 'pull_request' # only for pushes in PR | |
with: | |
name: site-build | |
path: doc_build | |
retention-days: 5 | |
# Upload the doc to github pages branch and publish if from a push to master | |
- name: Upload documentation to gh-pages | |
if: success() && github.ref == 'refs/heads/master' # only for pushes to master | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: doc_build |