-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 2.23 KB
/
Copy pathdeploy.yml
File metadata and controls
58 lines (49 loc) · 2.23 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
name: Deploy
# Deliberately not gated on CI: shipping while CI is red has to stay possible.
on:
push:
branches: [main]
workflow_dispatch:
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Queueing production keeps a second push from cancelling a live deploy.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
Deploy:
runs-on: ubuntu-24.04
timeout-minutes: 20
permissions:
contents: read
pull-requests: write
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
environment:
name: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }}
url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- if: ${{ github.event_name == 'pull_request' }}
name: Show wip message in sticky comment
uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
with:
message: "Version Preview URL: ⏳deployment is in progress..."
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: nemolize/actions/setup@ffbe3737f01cb4e563dd19424761da8c3c9a9173 # v1.2.0
- run: pnpm run build
- id: deploy
name: Deploy
uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4.0.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: ${{ github.ref == 'refs/heads/main' && 'deploy' || 'versions upload' }}
- if: ${{ github.event_name == 'pull_request' }}
name: Show version preview URL in sticky comment
uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
with:
message: "Version Preview URL: ${{ steps.deploy.outputs.deployment-url || '⚠️ no URL returned — is the workers.dev subdomain enabled?' }}"
- if: ${{ failure() && github.event_name == 'pull_request' }}
name: Show error message in sticky comment
uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
with:
message: "Version Preview URL: ❌deployment failed."