Skip to content

Add GitHub Actions workflow for building docs #3

Add GitHub Actions workflow for building docs

Add GitHub Actions workflow for building docs #3

Workflow file for this run

name: Build and Deploy Docs
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Sphinx and dependencies
run: |
pip install -U sphinx sphinx-rtd-theme sphinxcontrib-napoleon lightning
- name: Build Documentation
run: |
sphinx-build -b html docs/source public/
- name: Deploy to GitHub Pages
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git fetch --no-tags origin +refs/heads/gh-pages:refs/remotes/origin/gh-pages
git checkout gh-pages || git checkout --orphan gh-pages
rm -rf *
cp -r public/* .
git add .
git commit -m "Deploy updated documentation to GitHub Pages from commit $GITHUB_SHA"
git push origin gh-pages --force