Skip to content

Commit 6becea3

Browse files
lane711claude
andauthored
feat(stats): auto-deploy stats.sonicjs.com on main merges (#932)
- Add deploy-stats.yml CI workflow (triggers on packages/stats/** or packages/core/src/** changes to main + workflow_dispatch) - Build core, type-check, then wrangler deploy --env production - Add deploy:production script to packages/stats - Add deploy:stats convenience script to root package.json - Update wrangler compatibility_date to 2025-05-05 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0de9729 commit 6becea3

4 files changed

Lines changed: 44 additions & 1 deletion

File tree

.github/workflows/deploy-stats.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Deploy Stats
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'packages/stats/**'
9+
- 'packages/core/src/**'
10+
- '.github/workflows/deploy-stats.yml'
11+
workflow_dispatch:
12+
13+
jobs:
14+
deploy:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 15
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Build core package
32+
run: npm run build:core
33+
34+
- name: Type check stats
35+
run: cd packages/stats && npx tsc --noEmit
36+
37+
- name: Deploy stats to Cloudflare Workers (production)
38+
run: cd packages/stats && npx wrangler deploy --env production
39+
env:
40+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
41+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"build:core": "npm run plugins:generate && npm run build --workspace=@sonicjs-cms/core",
1919
"deploy": "npm run deploy --workspace=my-sonicjs-app",
2020
"deploy:www": "npm run deploy --workspace=www",
21+
"deploy:stats": "npm run deploy:production --workspace=sonicjs-stats",
2122
"test": "npm run test --workspace=@sonicjs-cms/core",
2223
"test:cov": "npm run test:cov --workspace=@sonicjs-cms/core",
2324
"test:watch": "npm run test:watch --workspace=@sonicjs-cms/core",

packages/stats/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"dev": "wrangler dev",
99
"build": "echo 'Worker build is handled by wrangler during deployment'",
1010
"deploy": "wrangler deploy",
11+
"deploy:production": "wrangler deploy --env production",
1112
"db:migrate": "wrangler d1 migrations apply DB",
1213
"db:migrate:local": "wrangler d1 migrations apply DB --local",
1314
"type-check": "tsc --noEmit"

packages/stats/wrangler.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "sonicjs-stats"
22
main = "src/index.ts"
3-
compatibility_date = "2024-09-23"
3+
compatibility_date = "2025-05-05"
44
compatibility_flags = ["nodejs_compat"]
55

66
# Cloudflare Workers settings

0 commit comments

Comments
 (0)