forked from pyropy/cf-metrics
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (41 loc) · 1.14 KB
/
ci.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: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cp wrangler.toml.example wrangler.toml
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm test
deploy:
if: github.ref == 'refs/heads/main'
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
preCommands: |
cp wrangler.toml.example wrangler.toml
envsubst < wrangler.toml.example > wrangler.toml
postCommands: |
rm -f wrangler.toml
environment: production
secrets: |
INFLUX_TOKEN
env:
INFLUX_METRIC_NAME: ${{ vars.INFLUX_METRIC_NAME }}
INFLUX_URL: ${{ vars.INFLUX_URL }}
INFLUX_TOKEN: ${{ secrets.INFLUX_TOKEN }}
INFLUX_DATABASE: ${{ vars.INFLUX_DATABASE }}