-
Notifications
You must be signed in to change notification settings - Fork 14
39 lines (36 loc) · 1.37 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
name: Deploy to Cloudflare workers
run-name: Deploy "${{ inputs.worker }}-${{ inputs.environment }}" by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
worker:
description: 'Name of the worker'
required: true
environment:
description: 'Choose an environment to deploy to: <beta|production>'
required: false
default: ''
commands:
description: 'Precommands'
default: 'npm install'
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v3
- name: Publish (beta or production)
if: github.event.inputs.environment == 'beta' || github.event.inputs.environment == 'production'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
preCommands: ${{ github.event.inputs.commands }}
workingDirectory: ${{ github.event.inputs.worker }}
command: publish --env ${{ github.event.inputs.environment }}
- name: Publish (default)
if: github.event.inputs.environment != 'beta' && github.event.inputs.environment != 'production'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
preCommands: ${{ github.event.inputs.commands }}
workingDirectory: ${{ github.event.inputs.worker }}