Skip to content

Build and Deploy Documentation #6

Build and Deploy Documentation

Build and Deploy Documentation #6

Workflow file for this run

name: Build and Deploy Documentation
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install sphinx
pip install sphinx-rtd-theme
- name: Fetch all tags
run: git fetch --tags
- name: Get latest version tag
id: get_latest_version
run: |
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) || echo "v0.0.0")
echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_ENV
# Generate Sphinx .rst files using sphinx-apidoc
- name: Generate .rst files
run: |
sphinx-apidoc -o docs WrenchCL/
# Generate Sphinx documentation using sphinx-build
- name: Generate documentation
run: |
sphinx-build -D release=${{ env.LATEST_TAG }} -b html docs docs/_build/html
touch docs/_build/html/.nojekyll
# Deploy to GitHub Pages
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_build/html
clean-exclude: |
.nojekyll