Add Cloudflare Pages preview builds for landing PRs

Triggers a preview deployment on pull requests that touch landing/
files. Posts the preview URL as a comment on the PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Gerwin Kuijntjes
2026-04-02 13:44:40 +02:00
parent a2eed3c38b
commit 6970ea40f3

View File

@@ -5,8 +5,15 @@ on:
branches: ["main"]
paths:
- "landing/**"
pull_request:
paths:
- "landing/**"
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
deploy:
runs-on: ubuntu-latest
@@ -32,9 +39,19 @@ jobs:
run: npm run build
- 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=pocketgraph-app
command: pages deploy dist --project-name=pocketgraph-app --branch=${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'main' }}
workingDirectory: landing
- name: Comment preview URL on PR
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v3
with:
message: |
🔍 **Preview deployment ready!**
${{ steps.deploy.outputs.deployment-url }}
comment-tag: cloudflare-preview