Documentation Build and Deploy CI #49
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: Documentation Build and Deploy CI | |
| on: | |
| # Wait for Compilation Tests workflow to complete (uses macOS binaries) | |
| workflow_run: | |
| workflows: ["Compilation Tests"] | |
| types: | |
| - completed | |
| branches: | |
| - master | |
| - release/v2.x | |
| - wokwi-embed-launchpad | |
| # Manual trigger for testing docs changes without waiting for compilation | |
| workflow_dispatch: | |
| # Also run on direct pushes to docs or workflow files (for testing) | |
| push: | |
| branches: | |
| - master | |
| - release/v2.x | |
| - wokwi-embed-launchpad | |
| paths: | |
| - "docs/**" | |
| - ".github/workflows/docs_build.yml" | |
| pull_request: | |
| paths: | |
| - "docs/**" | |
| - ".github/workflows/docs_build.yml" | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-docs: | |
| name: Build ESP-Docs | |
| runs-on: ubuntu-22.04 | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4 | |
| with: | |
| cache-dependency-path: docs/requirements.txt | |
| cache: "pip" | |
| python-version: "3.10" | |
| - name: Restore docs binaries from cache (macOS builds) | |
| id: cache-restore | |
| uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| with: | |
| key: docs-binaries-macos-${{ github.run_id }} | |
| restore-keys: | | |
| docs-binaries-macos- | |
| path: docs_binaries | |
| lookup-only: false | |
| - name: Prepare cached binaries for documentation | |
| run: | | |
| python3 .github/scripts/docs_build_examples.py -p | |
| python3 .github/scripts/docs_build_examples.py -c | |
| - name: Build | |
| run: | | |
| sudo apt update | |
| sudo apt install python3-pip python3-setuptools | |
| # GitHub CI installs pip3 and setuptools outside the path. | |
| # Update the path to include them and run. | |
| cd ./docs | |
| PATH=/home/runner/.local/bin:$PATH pip3 install -r requirements.txt --prefer-binary | |
| PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" build-docs -l en | |
| - name: Archive Docs | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: docs | |
| path: docs |