Merge pull request #6102 from super-productivity/claude/pr-deployment-previews-p5QsV

feat(ci): add Cloudflare Pages PR preview deployments
This commit is contained in:
Johannes Millan 2026-01-22 15:01:52 +01:00 committed by GitHub
commit a81f5601c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

78
.github/workflows/pr-preview-deploy.yml vendored Normal file
View file

@ -0,0 +1,78 @@
name: PR Preview Deploy
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
deployments: write
jobs:
deploy-preview:
runs-on: ubuntu-latest
env:
UNSPLASH_KEY: ${{ secrets.UNSPLASH_KEY }}
UNSPLASH_CLIENT_ID: ${{ secrets.UNSPLASH_CLIENT_ID }}
steps:
- name: Check out Git repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: 'npm'
# work around for npm installs from git+https://github.com/johannesjo/J2M.git
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- name: Install npm Packages
run: npm ci
- name: Generate environment file
run: npm run env
- name: Build Frontend for Web
run: npm run buildFrontend:prodWeb
- name: Deploy to Cloudflare Pages
id: cloudflare-deploy
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist/browser --project-name=super-productivity-preview --branch=${{ github.head_ref }}
- name: Find existing comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- pr-preview-comment -->'
- name: Create or update PR comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1ebb043 # v4
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
<!-- pr-preview-comment -->
## Preview Deployment
| Status | URL |
|--------|-----|
| Deployed | ${{ steps.cloudflare-deploy.outputs.deployment-url }} |
**Branch:** `${{ github.head_ref }}`
**Commit:** ${{ github.sha }}
---
<sub>Deployed with Cloudflare Pages</sub>