Update workshop content and publishing process #2
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: Render workshop | |
| # On PR: run scripts/render-markdown.py as a validation gate. Hard-fails on any | |
| # render error (missing partial, unresolved component, broken link, missing | |
| # image) or lychee error. Does NOT commit anywhere. | |
| # | |
| # On push to main: re-runs validation, then regenerates workshop/ and commits | |
| # any diff back to main as github-actions[bot]. The commit message contains | |
| # [skip ci] to avoid triggering this workflow recursively. pages.yml watches | |
| # docs/**, not workshop/**, so it also will not re-fire on the bot commit. | |
| # | |
| # The validate and commit steps are split into separate jobs so that PR runs | |
| # (which never push) execute with read-only contents permission. Only the | |
| # main-branch commit job is granted contents:write. | |
| on: | |
| pull_request: | |
| paths: | |
| - 'docs/src/content/docs/**' | |
| - 'scripts/render-markdown.py' | |
| - '.github/workflows/render-markdown.yml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'docs/src/content/docs/**' | |
| - 'scripts/render-markdown.py' | |
| - '.github/workflows/render-markdown.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate: | |
| name: Validate render + links | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Render workshop content | |
| run: python scripts/render-markdown.py | |
| - name: Link check (lychee) | |
| uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.6.1 | |
| with: | |
| args: --offline --no-progress 'workshop/**/*.md' | |
| fail: true | |
| commit: | |
| name: Regenerate workshop/ on main | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: validate | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # only granted on the push-to-main path so the bot can push the regenerated workshop/ | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Render workshop content | |
| run: python scripts/render-markdown.py | |
| - name: Commit regenerated workshop/ | |
| run: | | |
| if [[ -z "$(git status --porcelain workshop/)" ]]; then | |
| echo "workshop/ is already in sync — nothing to commit." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add workshop/ | |
| git commit -m "chore(workshop): regenerate workshop/ from docs/src/content/docs/ | |
| Triggered by ${{ github.sha }} (${{ github.actor }}). | |
| [skip ci]" | |
| git push |