feat: redesigned landing page with 5 variants for A/B testing #491
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: Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| concurrency: | |
| group: mpp-docs-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Check code | |
| run: pnpm check | |
| - name: Check types | |
| run: pnpm check:types | |
| - name: Tests | |
| run: pnpm test | |
| - name: Build | |
| run: pnpm build | |
| env: | |
| SPEC_PAT: ${{ secrets.SPEC_PAT }} | |
| - name: Smoke test (wrangler dev) | |
| run: | | |
| # ────────────────────────────────────────────────────────── | |
| # To reproduce locally: | |
| # pnpm build | |
| # pnpm wrangler:dev & | |
| # curl -s -o /dev/null -w '%{http_code}' http://localhost:8788/quickstart/tempoctl -H 'Accept: text/html' | |
| # curl -s -o /dev/null -w '%{http_code}' http://localhost:8788/ -H 'Accept: text/html' | |
| # curl -s -o /dev/null -w '%{http_code}' http://localhost:8788/ -H 'Accept: text/markdown' | |
| # All three should return 200. If any return 500, check wrangler | |
| # logs for the error — usually a missing module or unsupported | |
| # Node.js API. Fix in scripts/patch-cf.ts. | |
| # ────────────────────────────────────────────────────────── | |
| WRANGLER_LOG=$(mktemp) | |
| npx wrangler dev --port 8788 > "$WRANGLER_LOG" 2>&1 & | |
| WRANGLER_PID=$! | |
| # Wait for wrangler to be ready (up to 30s) | |
| for i in $(seq 1 30); do | |
| if curl -sf http://localhost:8788/ -o /dev/null 2>/dev/null; then | |
| break | |
| fi | |
| if ! kill -0 $WRANGLER_PID 2>/dev/null; then | |
| echo "ERROR: wrangler exited before becoming ready" | |
| cat "$WRANGLER_LOG" | |
| exit 1 | |
| fi | |
| sleep 1 | |
| done | |
| FAILED=0 | |
| check_route() { | |
| local URL=$1 LABEL=$2 ACCEPT=$3 | |
| BODY=$(mktemp) | |
| STATUS=$(curl -s -o "$BODY" -w '%{http_code}' "$URL" -H "Accept: $ACCEPT") | |
| if [ "$STATUS" != "200" ]; then | |
| echo "FAIL: $LABEL returned $STATUS (expected 200)" | |
| echo "--- response body (first 40 lines) ---" | |
| head -40 "$BODY" | |
| echo "---" | |
| FAILED=1 | |
| else | |
| echo "OK: $LABEL → $STATUS" | |
| fi | |
| rm -f "$BODY" | |
| } | |
| check_route 'http://localhost:8788/quickstart/tempoctl' '/quickstart/tempoctl (html)' 'text/html' | |
| check_route 'http://localhost:8788/' '/ (html)' 'text/html' | |
| check_route 'http://localhost:8788/' '/ (markdown/llms.txt)' 'text/markdown' | |
| kill $WRANGLER_PID 2>/dev/null || true | |
| wait $WRANGLER_PID 2>/dev/null || true | |
| if [ "$FAILED" = "1" ]; then | |
| echo "" | |
| echo "=== wrangler dev logs ===" | |
| cat "$WRANGLER_LOG" | |
| fi | |
| rm -f "$WRANGLER_LOG" | |
| exit $FAILED | |
| - name: Prune server bundle | |
| run: node --experimental-strip-types scripts/prune-server.ts | |
| - name: Upload build | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| deploy: | |
| needs: ci | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Download build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Sanitize branch name | |
| if: github.event_name == 'pull_request' | |
| id: branch | |
| run: echo "alias=$(echo '${{ github.head_ref }}' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g')" >> $GITHUB_OUTPUT | |
| - name: Deploy to Cloudflare | |
| id: deploy | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: . | |
| wranglerVersion: "4.61.1" | |
| command: ${{ github.event_name == 'pull_request' && format('versions upload --preview-alias={0}', steps.branch.outputs.alias) || 'deploy' }} | |
| - name: Post Preview Comment | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const alias = "${{ steps.branch.outputs.alias }}" | |
| const url = `https://${alias}-mpp-docs.porto.workers.dev` | |
| const body = `MPP Docs preview: ${url}` | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }) | |
| let existing = null | |
| for (const comment of comments) { | |
| if (comment.body && comment.body.startsWith('MPP Docs preview:')) { | |
| existing = comment | |
| break | |
| } | |
| } | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }) | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }) | |
| } |