-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.79 KB
/
Copy pathdeploy.yml
File metadata and controls
53 lines (44 loc) · 1.79 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
name: Deploy
on:
push:
branches: [main]
workflow_dispatch:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Queue production deploys so a rapid second push cannot cancel an
# in-flight deploy; preview uploads are safe to supersede.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
contents: read
jobs:
Deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
# `pull-requests: write` is needed only by the sticky-comment steps, which
# are themselves gated on `github.event_name == 'pull_request'`.
permissions:
contents: read
pull-requests: write
steps:
- uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
with:
message: "Version Preview URL: ⏳deployment is in progress..."
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- uses: nemolize/actions/setup@ffbe3737f01cb4e563dd19424761da8c3c9a9173 # v1.2.0
- run: pnpm run build
- id: deploy
name: Deploy
uses: cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: ${{ github.event_name == 'push' && 'deploy' || 'versions upload' }}
- if: ${{ github.event_name == 'pull_request' }}
name: Post preview URL comment
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
with:
message: "Version Preview URL: ${{ steps.deploy.outputs.deployment-url }}"
- if: failure()
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
with:
message: "Version Preview URL: ❌deployment failed."