-
Notifications
You must be signed in to change notification settings - Fork 839
50 lines (41 loc) · 1.18 KB
/
cloudflare.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
name: Deploy to Cloudflare Workers
on:
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy to Cloudflare
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Create Wrangler config
run: |
touch wrangler.toml
cat << 'EOF' > wrangler.toml
${{secrets.WRANGLER_TOML}}
EOF
- name: Install dependencies
run: |
npm install -g pnpm
pnpm install
- name: Build project
run: pnpm run build:workers
- name: Deploy to Cloudflare
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: pnpm run wrangler deploy --config=wrangler.toml > /dev/null
- name: Verify deployment
run: |
url=${{ secrets.CF_WORKERS_DOMAIN }}
if [ -z "$url" ]; then
echo "::warning::CF_WORKERS_DOMAIN is not set"
else
echo "Verifying deployment at https://$url/init"
curl -s -o /dev/null https://$url/init
fi