Add GitHub Actions workflow for building docs #4
Workflow file for this run
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
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" | |
if git ls-remote --exit-code origin gh-pages; then | |
git fetch origin gh-pages | |
git checkout gh-pages | |
else | |
git checkout --orphan gh-pages | |
fi | |
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 |