Skip to content

Commit 38afd84

Browse files
committed
ci: add GitHub Actions workflow for auto-deploy on push and PR checks
1 parent 79a5803 commit 38afd84

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 22
24+
cache: npm
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Build
30+
run: npm run build
31+
32+
deploy:
33+
needs: build
34+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
deployments: write
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Setup Node
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: 22
47+
cache: npm
48+
49+
- name: Install dependencies
50+
run: npm ci
51+
52+
- name: Build
53+
run: npm run build
54+
55+
- name: Deploy to Cloudflare Workers
56+
uses: cloudflare/wrangler-action@v3
57+
with:
58+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}

0 commit comments

Comments
 (0)