3 setup workflow pages deployment #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 Documentation | |
on: | |
push: | |
branches: | |
- '*' # Trigger on push to any branch | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install .[docs] | |
- name: Build documentation | |
id: build | |
run: | | |
cd docs | |
sphinx-build -M html ./source ./build | |
echo "build_dir=$(pwd)/_build/html" >> $GITHUB_ENV | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'pull_request' # Only deploy on pull requests | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Deploy documentation | |
uses: actions/deploy-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_build/html |