-
Notifications
You must be signed in to change notification settings - Fork 36
53 lines (45 loc) · 1.3 KB
/
worker.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
name: Deploy Worker
on:
push:
branches:
- master
pull_request:
jobs:
publish_worker:
if: ${{ github.repository_owner == 'cloudflare' }}
name: Deploy Worker
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
- name: Install Yarn Dependencies
run: yarn install
- name: Install NPM Dependencies
run: npm ci
working-directory: worker
- name: Run tests
run: npm run test
working-directory: worker
- name: Deploy worker
run: npm run deploy
env:
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CF_API_KEY: ${{ secrets.CF_GLOBAL_APIKEY }}
CF_EMAIL: ${{ secrets.CF_EMAIL }}
working-directory: worker
# Only deploy to production on the master branch
- name: Deploy Worker (production)
if: github.event_name != 'pull_request'
run: npm run deploy:production
env:
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CF_API_KEY: ${{ secrets.CF_GLOBAL_APIKEY }}
CF_EMAIL: ${{ secrets.CF_EMAIL }}
working-directory: worker