File tree 1 file changed +50
-0
lines changed
1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : ' Preview Deployment'
2
+ on :
3
+ pull_request_target :
4
+ branches :
5
+ - master
6
+
7
+ jobs :
8
+ deploy :
9
+ permissions :
10
+ actions : read
11
+ contents : read
12
+ deployments : write
13
+ pull-requests : write
14
+ runs-on : ubuntu-latest
15
+ timeout-minutes : 5
16
+ steps :
17
+ - name : Checkout code
18
+ uses : actions/checkout@v4
19
+
20
+ - name : Cache node_modules
21
+ uses : actions/cache@v4
22
+ with :
23
+ path : node_modules/
24
+ key : node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
25
+
26
+ - name : Install node.js
27
+ uses : actions/setup-node@v4
28
+ with :
29
+ node-version-file : ' .nvmrc'
30
+
31
+ - run : npm install yarn -g
32
+ - run : yarn install
33
+ - run : yarn build
34
+
35
+ - name : Deploy to Cloudflare
36
+ id : deploy
37
+ uses : cloudflare/wrangler-action@v3
38
+ with :
39
+ apiToken : ${{ secrets.CLOUDFLARE_API_TOKEN }}
40
+ accountId : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
41
+ command : pages deploy src/dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --branch ${{ github.head_ref }} --commit-dirty=true
42
+
43
+ - name : Add deployment comment
44
+ uses : thollander/actions-comment-pull-request@v3
45
+ with :
46
+ message : |
47
+ Preview URL: ${{ steps.deploy.outputs.deployment-url }}
48
+ reactions : eyes, rocket
49
+ comment-tag : ' Preview URL'
50
+ mode : recreate
You can’t perform that action at this time.
0 commit comments