Build and Deploy gh-pages sphinx documentation #6
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: Deploy Documentation to GitHub Pages | |
on: | |
push: | |
branches: | |
- main # Trigger the workflow on push to the main branch | |
paths: | |
- 'docs/**' # Trigger only when files in the /docs directory are changed | |
workflow_dispatch: # This adds the manual trigger | |
permissions: | |
id-token: write | |
contents: write | |
pages: write | |
jobs: | |
deploy: | |
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.x' | |
- name: Install Pandoc | |
run: sudo apt-get install pandoc | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install sphinx nbsphinx sphinx_rtd_theme | |
pip install -r requirements.txt | |
- name: Build documentation | |
run: | | |
cd docs | |
make html # Build documentation into HTML | |
- name: Deploy | |
uses: actions/deploy-pages@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} # GitHub token is required | |