forked from simonw/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.52 KB
/
deploy-cloudflare-workers.yml
File metadata and controls
51 lines (45 loc) · 1.52 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
name: Deploy Cloudflare Workers
on:
push:
branches:
- main
paths:
- 'cloudflare-workers/**'
workflow_dispatch: # Allow manual triggering
jobs:
changes: # Use https://github.com/dorny/paths-filter to check what workers were changed
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
gumroad-products: ${{ steps.filter.outputs.gumroad-products }}
# If I add more filters below, I need to “export them” here.
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
gumroad-products:
- 'cloudflare-workers/gumroad-products/**'
# I can add more filters here and access them separately.
deploy-gumroad-products:
name: Deploy Gumroad Products Worker
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.gumroad-products == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Wrangler
run: npm install -g wrangler
- name: Deploy to Cloudflare Workers
working-directory: cloudflare-workers/gumroad-products
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
wrangler deploy --env production