Skip to content

Build Documentation #29

Build Documentation

Build Documentation #29

Workflow file for this run

name: Build Documentation
on:
workflow_dispatch:
workflow_call:
inputs:
publish:
required: true
type: boolean
release:
types: [ released ]
jobs:
build_docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch the complete repo history (for setuptools-scm)
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-cache-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
pip-cache
- name: Install python requirements
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build twine
python -m pip install -r requirements/dev.txt
- name: Create cache directory
run: |
mkdir doc_cache # make sure cache dir exists
- name: Cache FastF1
uses: actions/cache@v3
with:
path: ./doc_cache
key: fastf1-doc-cache-${{ hashFiles('*.*') }}
restore-keys: |
fastf1-doc-cache
- name: Install Fast-F1 from sources
run: |
python -m pip install -e .
- name: Create doc build dir
run: |
mkdir -p docs/_build/html
- name: Checkout current docs
uses: actions/checkout@v3
with:
ref: gh-pages
path: docs/_build/html
- name: Build docs
run: |
mkdir test_cache # not really need but pytest setup relies on it
sphinx-build ./docs ./docs/_build/html -a -E -W -n --keep-going
- name: Publish docs
if: (github.event_name == 'release') || inputs.publish
run: |
cd docs/_build/html
git add .
git config user.name github-actions
git config user.email [email protected]
git commit -m "$GITHUB_REF_NAME ($GITHUB_JOB) ci release"
git push origin gh-pages --force
- name: Upload docs as artifact
uses: actions/upload-artifact@v3
if: github.event_name != 'release'
with:
name: Documentation Build
path: docs/_build/html