-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.06 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
name: Deploy Cloudflare Workers
on:
push:
branches:
- main
repository_dispatch:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate wrangler.toml
run: |
cat << EOF > wrangler.toml
name = "google-analytics-endpoint"
type = "javascript"
main = "worker.js"
compatibility_date = "2024-11-10"
workers_dev = false
routes = [
{ pattern = "${{ secrets.GA_ENDPOINT_URL }}", zone_id = "${{ secrets.ZONE_ID }}" }
]
[vars]
MEASUREMENT_ID = "${{ secrets.MEASUREMENT_ID }}"
[observability]
enabled = true
head_sampling_rate = 1
[placement]
mode = "smart"
EOF
- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --var VERSION:${{ github.sha }}