Upgrade wat-lsp to 0.8.0 and add syntax highlighting to instruction code blocks #4
Workflow file for this run
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: Web Build CI | |
| on: | |
| push: | |
| branches: [main] | |
| paths: [web-build/**, exercises/**, patch/**] | |
| pull_request: | |
| paths: [web-build/**, exercises/**, patch/**] | |
| defaults: | |
| run: | |
| working-directory: web-build | |
| jobs: | |
| chapter-parity: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Check exercise ↔ chapter parity | |
| run: node check-chapters.mjs | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: web-build/package-lock.json | |
| - run: npm ci | |
| - name: Generate lessons | |
| run: npm run generate | |
| - name: Check formatting | |
| run: npm run format:check | |
| - name: Type check | |
| run: npm run typecheck | |
| - name: Build | |
| run: npm run build | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: web-build-dist | |
| path: web-build/dist/ | |
| deploy: | |
| name: Deploy to Cloudflare Pages | |
| needs: check | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| deployments: write | |
| pull-requests: write | |
| steps: | |
| - name: Download build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: web-build-dist | |
| path: dist | |
| - name: Deploy to Cloudflare Pages | |
| id: deploy | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy dist --project-name=watlings --branch=${{ github.head_ref || github.ref_name }} | |
| - name: Comment preview URL on PR | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const url = '${{ steps.deploy.outputs.deployment-url }}'; | |
| const sha = context.payload.pull_request.head.sha.substring(0, 7); | |
| const body = `## 🌐 Preview\n\nDeployed to Cloudflare Pages:\n${url} (\`${sha}\`)`; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(c => | |
| c.user.type === 'Bot' && c.body.includes('## 🌐 Preview') | |
| ); | |
| if (botComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } |