ci(docs+tests) Bootstrap pnpm + Node for sphinx-vite-builder source b… #1166
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: docs | |
| on: | |
| push: | |
| branches: | |
| - master | |
| # [DO NOT MERGE] preview branch for gp-sphinx PR #36 — revert before merge. | |
| - improved-defaults-reprs | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: docs | |
| strategy: | |
| matrix: | |
| python-version: ['3.14'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Filter changed file paths to outputs | |
| uses: dorny/paths-filter@v4.0.1 | |
| id: changes | |
| with: | |
| filters: | | |
| root_docs: | |
| - CHANGES | |
| - README.* | |
| docs: | |
| - 'docs/**' | |
| - 'examples/**' | |
| python_files: | |
| - 'src/libtmux/**' | |
| - uv.lock | |
| - pyproject.toml | |
| - name: Should publish | |
| if: steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true' | |
| run: echo "PUBLISH=$(echo true)" >> $GITHUB_ENV | |
| - name: Install uv | |
| if: env.PUBLISH == 'true' | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| if: env.PUBLISH == 'true' | |
| run: uv python install ${{ matrix.python-version }} | |
| # [DO NOT MERGE] pnpm + Node bootstrap for sphinx-vite-builder source build | |
| # of gp-furo-theme — required while gp-sphinx-family deps resolve from the | |
| # improved-defaults-reprs branch (see [tool.uv.sources]). Revert with the | |
| # uv.sources block when gp-sphinx>=0.0.1a18 lands. | |
| - name: Install pnpm | |
| if: env.PUBLISH == 'true' | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 10 | |
| - name: Set up Node | |
| if: env.PUBLISH == 'true' | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies [w/ docs] | |
| if: env.PUBLISH == 'true' | |
| run: uv sync --all-extras --dev | |
| - name: Install just | |
| if: env.PUBLISH == 'true' | |
| uses: extractions/setup-just@v4 | |
| - name: Print python versions | |
| if: env.PUBLISH == 'true' | |
| run: | | |
| python -V | |
| uv run python -V | |
| - name: Cache sphinx fonts | |
| if: env.PUBLISH == 'true' | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/sphinx-fonts | |
| key: sphinx-fonts-${{ hashFiles('docs/conf.py') }} | |
| restore-keys: | | |
| sphinx-fonts- | |
| - name: Build documentation | |
| if: env.PUBLISH == 'true' | |
| run: | | |
| cd docs && just html | |
| - name: Configure AWS Credentials | |
| if: env.PUBLISH == 'true' | |
| uses: aws-actions/configure-aws-credentials@v6 | |
| with: | |
| role-to-assume: ${{ secrets.LIBTMUX_DOCS_ROLE_ARN }} | |
| aws-region: us-east-1 | |
| - name: Push documentation to S3 | |
| if: env.PUBLISH == 'true' | |
| run: | | |
| aws s3 sync docs/_build/html "s3://${{ secrets.LIBTMUX_DOCS_BUCKET }}" \ | |
| --delete --follow-symlinks | |
| - name: Invalidate CloudFront | |
| if: env.PUBLISH == 'true' | |
| run: | | |
| aws cloudfront create-invalidation \ | |
| --distribution-id "${{ secrets.LIBTMUX_DOCS_DISTRIBUTION }}" \ | |
| --paths "/index.html" "/objects.inv" "/searchindex.js" | |
| - name: Purge cache on Cloudflare | |
| if: env.PUBLISH == 'true' | |
| uses: jakejarvis/cloudflare-purge-action@v0.3.0 | |
| env: | |
| CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | |
| CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} |