Deploy Sphinx Docs to GitHub Pages #113
Workflow file for this run
This file contains hidden or 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 Sphinx Docs to GitHub Pages | |
| on: | |
| workflow_dispatch: # gets dispatched from PR tagging workflow or manually | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install pandoc (system-level) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pandoc | |
| - name: Install Python dependencies and local package | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install .[dev] | |
| - name: Build Sphinx documentation | |
| run: | | |
| sphinx-build -b html docs/ docs/_build/html | |
| - name: Copy Streamlit app to docs output root | |
| run: | | |
| cp docs/_static/app_streamlit.html docs/_build/html/ | |
| # Add _headers for Stlite Cross-Origin Isolation --- | |
| - name: Add Cross-Origin Headers for Stlite | |
| run: | | |
| echo "/*" > docs/_build/html/_headers | |
| echo " Cross-Origin-Opener-Policy: same-origin" >> docs/_build/html/_headers | |
| echo " Cross-Origin-Embedder-Policy: require-corp" >> docs/_build/html/_headers | |
| # Create ZIP Artifact for Download | |
| - name: Compress Docs to ZIP | |
| run: zip -r docs-preview.zip docs/_build/html | |
| - name: Upload Docs Preview Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs-preview | |
| path: docs-preview.zip # Uploads the newly created .zip file | |
| retention-days: 1 | |
| - name: Upload artifact # This is the Pages artifact uploader | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/_build/html | |
| - name: Get latest tag to decide whether to deploy | |
| run: | | |
| echo "tag=$(git describe --tags --abbrev=0)" | |
| echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | |
| id: get-tag | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| if: ${{ !contains(steps.get-tag.outputs.tag , 'rc') }} | |
| uses: actions/deploy-pages@v4 |