build docs with github pages (#15137) #3
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: | |
pull_request: | |
branches: | |
- '**' | |
push: | |
branches: | |
- main | |
jobs: | |
build_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: pip install -r requirements/docs.txt | |
- name: Build documentation | |
run: make -C docs html | |
- name: Upload artifact for deployment (Push to main) | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: docs/_build/html | |
deploy: | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
needs: build_docs | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
steps: | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |