mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-25 17:03:52 +00:00
83 lines
2.7 KiB
YAML
83 lines
2.7 KiB
YAML
name: PR Preview Deploy
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, synchronize, reopened]
|
|
paths-ignore:
|
|
- 'docs/wiki/**'
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
deployments: write
|
|
|
|
jobs:
|
|
deploy-preview:
|
|
continue-on-error: true
|
|
runs-on: ubuntu-latest
|
|
environment: preview-deployments
|
|
env:
|
|
UNSPLASH_KEY: ${{ secrets.UNSPLASH_KEY }}
|
|
UNSPLASH_CLIENT_ID: ${{ secrets.UNSPLASH_CLIENT_ID }}
|
|
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
|
with:
|
|
node-version: 22
|
|
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 i
|
|
|
|
- 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.14.1
|
|
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@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
|
|
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@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
|
|
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>
|