-
Notifications
You must be signed in to change notification settings - Fork 75
94 lines (85 loc) · 2.74 KB
/
pull-request.yml
File metadata and controls
94 lines (85 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Pull Request
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
NODE_ENV: production
WRANGLER_SEND_METRICS: false
jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit
deploy-preview:
name: Deploy Preview (${{ matrix.app }}${{ matrix.env && format('-{0}', matrix.env) || '' }})
runs-on: ubuntu-latest
permissions:
issues: write
contents: read
pull-requests: write
strategy:
matrix:
include:
#### explorer
- app: explorer
env: testnet
- app: explorer
env: moderato
- app: explorer
env: devnet
#### fee-payer
- app: fee-payer
env: privy
- app: fee-payer
env: devnet
- app: fee-payer
env: testnet
#### other (single-env-apps)
- app: og
- app: tokenlist
env:
NODE_ENV: production
CLOUDFLARE_ENV: ${{ matrix.env || '' }}
steps:
- name: Clone repository
uses: actions/checkout@v6
with:
submodules: "recursive"
fetch-depth: 0
# deploy workspace preview only if there are relevant changes
# deploy all apps if root lockfile is changed
- name: Check for relevant changes
id: changes
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -qE "^(apps/${{ matrix.app }}/|pnpm-lock.yaml)"; then
echo "relevant=true" >> $GITHUB_OUTPUT
else
echo "relevant=false" >> $GITHUB_OUTPUT
fi
- name: Install dependencies
if: steps.changes.outputs.relevant == 'true'
uses: ./.github/actions/install-dependencies
- name: Build
if: steps.changes.outputs.relevant == 'true'
run: pnpm build
working-directory: apps/${{ matrix.app }}
- name: Upload Worker Version
if: steps.changes.outputs.relevant == 'true'
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: apps/${{ matrix.app }}
environment: ${{ env.CLOUDFLARE_ENV }}
command: versions upload
- name: Comment Preview URL on PR
if: steps.changes.outputs.relevant == 'true'
uses: moojing/cf-preview-bot@v1
with:
deployment_url: ${{ steps.deploy.outputs.deployment-url }}
branch_preview_url: ${{ steps.deploy.outputs.pages-deployment-alias-url }}