Merge pull request #794 from mayborn005/feat/781-controlled-sw-update… #275
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 API Documentation | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'docs/**' | |
| - 'docs-site/**' | |
| - 'src/lib/**' | |
| pull_request: | |
| branches: | |
| - master | |
| paths: | |
| - 'docs/**' | |
| - 'docs-site/**' | |
| - 'src/lib/**' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| # ───────────────────────────────────────────── | |
| # Regenerate the auto-generated API reference | |
| # ───────────────────────────────────────────── | |
| generate-api-docs: | |
| name: Generate API Reference | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install root dependencies | |
| run: npm ci | |
| - name: Regenerate API reference from JSDoc | |
| run: npm run docs:api:generate | |
| - name: Upload generated docs | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: generated-api-docs | |
| path: docs/api/generated/ | |
| retention-days: 1 | |
| # ───────────────────────────────────────────── | |
| # Detect documentation drift (broken paths, | |
| # scripts, commands, and links) | |
| # ───────────────────────────────────────────── | |
| validate-docs-drift: | |
| name: Validate Docs Drift | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install root dependencies | |
| run: npm ci | |
| - name: Validate documentation drift | |
| run: npm run docs:validate-drift | |
| # ───────────────────────────────────────────── | |
| # Validate example scripts run without errors | |
| # ───────────────────────────────────────────── | |
| validate-examples: | |
| name: Validate Example Scripts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install root dependencies | |
| run: npm ci | |
| - name: Check JS examples syntax | |
| run: | | |
| for f in docs/api/examples/js/*.mjs docs/api/examples/js/*.js; do | |
| echo "Checking: $f" | |
| node --check "$f" | |
| done | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Check Python examples syntax | |
| run: | | |
| for f in docs/api/examples/python/*.py; do | |
| echo "Checking: $f" | |
| python -m py_compile "$f" | |
| done | |
| # ───────────────────────────────────────────── | |
| # Build Docusaurus site | |
| # ───────────────────────────────────────────── | |
| build-docs-site: | |
| name: Build Docusaurus | |
| runs-on: ubuntu-latest | |
| needs: [generate-api-docs] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download generated docs | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: generated-api-docs | |
| path: docs/api/generated/ | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: docs-site/package.json | |
| - name: Install Docusaurus dependencies | |
| run: npm ci | |
| working-directory: docs-site | |
| - name: Build Docusaurus site | |
| run: npm run build | |
| working-directory: docs-site | |
| env: | |
| NODE_ENV: production | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs-site/build/ | |
| # ───────────────────────────────────────────── | |
| # Deploy to GitHub Pages (master branch only) | |
| # ───────────────────────────────────────────── | |
| deploy-docs: | |
| name: Deploy to GitHub Pages | |
| runs-on: ubuntu-latest | |
| needs: build-docs-site | |
| if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |