Remove hash based code and use Pyodide/WASM #26
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
| # Deploy multilingual docs to GitHub Pages. | |
| # | |
| # Jobs: | |
| # 1. test-blocks — verify every executable doc code block runs correctly. | |
| # 2. build-jekyll — build the Jekyll site. | |
| # 3. deploy — publish _site/ to GitHub Pages. | |
| # | |
| # The interactive REPL and inline Run buttons execute code client-side via | |
| # Pyodide (ProgramExecutor), so no server-side WASM bundle is required. | |
| # | |
| # Trigger: every push to main, or manually via workflow_dispatch. | |
| name: Build and deploy docs | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| # Required for the deploy-pages action. | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Cancel in-progress runs on the same branch so pushes don't queue up. | |
| concurrency: | |
| group: pages-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ── Job 1: Test every executable doc block ──────────────────────────────── | |
| test-blocks: | |
| name: Test doc code blocks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout docs repo | |
| uses: actions/checkout@v4 | |
| - name: Checkout multilingual source | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: johnsamuelwrites/multilingual | |
| path: multilingual-src | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: pip | |
| cache-dependency-path: multilingual-src/pyproject.toml | |
| - name: Install multilingual | |
| working-directory: multilingual-src | |
| run: pip install -e ".[dev]" | |
| - name: Install pytest | |
| run: pip install pytest | |
| - name: Run code-block tests | |
| run: pytest _tests/ -v --tb=short | |
| # ── Job 2: Build Jekyll ─────────────────────────────────────────────────── | |
| build-jekyll: | |
| name: Build Jekyll site | |
| runs-on: ubuntu-latest | |
| needs: test-blocks | |
| steps: | |
| - name: Checkout docs repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.3' | |
| bundler-cache: true # runs `bundle install` and caches gems | |
| - name: Configure GitHub Pages | |
| id: pages | |
| uses: actions/configure-pages@v5 | |
| # Jekyll is built with JEKYLL_ENV=production so jekyll-seo-tag, | |
| # jekyll-sitemap, etc. output canonical URLs correctly. | |
| - name: Build Jekyll site | |
| env: | |
| JEKYLL_ENV: production | |
| run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | |
| - name: Upload Pages artefact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site/ | |
| # ── Job 3: Deploy ───────────────────────────────────────────────────────── | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| runs-on: ubuntu-latest | |
| needs: build-jekyll | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deploy | |
| uses: actions/deploy-pages@v4 |