-
-
Notifications
You must be signed in to change notification settings - Fork 11
55 lines (46 loc) · 1.65 KB
/
deploy.yml
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
name: Deploy Worker
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
name: Deploy Cloudflare Worker
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
with:
egress-policy: audit
- name: Git Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Deploy to Staging
if: github.event_name == 'push'
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: deploy --env staging
- name: Deploy to Production
if: github.event_name == 'workflow_dispatch'
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: deploy --env prod
- name: Alert on Failure
if: failure() && github.repository == 'nodejs/release-cloudflare-worker'
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # 2.3.3
env:
SLACK_COLOR: '#DE512A'
SLACK_ICON: https://github.com/nodejs.png?size=48
SLACK_TITLE: Deployment failed (${{ github.ref }})
SLACK_MESSAGE: A deployment of the Release Worker has failed.
SLACK_USERNAME: nodejs-bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}