docs: add English blog post on Figma-to-code visual validation #80
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 Docs to Cloudflare Pages | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'docs/**' | |
| pull_request: | |
| paths: | |
| - 'docs/**' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| deployments: write | |
| pull-requests: write | |
| jobs: | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| cache-dependency-path: docs/pnpm-lock.yaml | |
| - name: Install dependencies | |
| working-directory: docs | |
| run: pnpm install --frozen-lockfile | |
| - name: Build docs | |
| working-directory: docs | |
| run: pnpm build | |
| - name: Generate SEO/AEO assets | |
| working-directory: docs | |
| run: | | |
| pnpm seo:check || true | |
| pnpm seo:sync || true | |
| # Production deploy (push to main) | |
| - name: Deploy to Production | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: cloudflare/wrangler-action@v3 | |
| id: deploy-production | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy docs/build --project-name=ralph-starter-docs --branch=main | |
| # Preview deploy (pull requests) | |
| - name: Deploy Preview | |
| if: github.event_name == 'pull_request' | |
| uses: cloudflare/wrangler-action@v3 | |
| id: deploy-preview | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy docs/build --project-name=ralph-starter-docs --branch=${{ github.head_ref }} | |
| # Comment preview URL on the PR | |
| - name: Comment Preview URL | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const branch = context.payload.pull_request.head.ref | |
| .replace(/[^a-zA-Z0-9-]/g, '-') | |
| .substring(0, 28); | |
| const previewUrl = `https://${branch}.ralph-starter-docs.pages.dev`; | |
| // Check for existing bot comment to avoid duplicates | |
| 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('Docs Preview') | |
| ); | |
| const body = `### 🔗 Docs Preview\n\n**Preview URL:** ${previewUrl}\n\nThis preview was deployed from the latest commit on this PR.`; | |
| 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, | |
| }); | |
| } |