Skip to content

Commit 0f4894b

Browse files
committed
ci: add deploy workflow for Cloudflare Workers
1 parent 3a871dc commit 0f4894b

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy Website
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20'
18+
19+
- name: Install dependencies
20+
run: npm install --legacy-peer-deps
21+
22+
- name: Build
23+
run: npm run build
24+
25+
- name: Install Wrangler
26+
run: npm install -g wrangler
27+
28+
- name: Run D1 Migrations
29+
env:
30+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
31+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
32+
run: |
33+
for migration in migrations/*.sql; do
34+
if [ -f "$migration" ]; then
35+
echo "Applying migration: $migration"
36+
wrangler d1 execute openboot --remote --file="$migration" || true
37+
fi
38+
done
39+
40+
- name: Deploy
41+
uses: cloudflare/wrangler-action@v3
42+
with:
43+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
44+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

0 commit comments

Comments
 (0)