Skip to content

Commit e828d54

Browse files
committed
feat: add CI/CD workflows for linting, type checking, and API deployment
1 parent 91fd2fd commit e828d54

4 files changed

Lines changed: 106 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
concurrency:
9+
group: ci-${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11+
12+
jobs:
13+
lint-and-type-check:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: pnpm/action-setup@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
cache: pnpm
24+
25+
- name: Install dependencies
26+
run: pnpm install --frozen-lockfile
27+
28+
- name: Biome check
29+
run: pnpm lint
30+
31+
- name: Type check
32+
run: pnpm type-check

.github/workflows/deploy-api.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy API
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'apps/api/**'
8+
- 'packages/db/**'
9+
- 'packages/shared/**'
10+
- 'pnpm-lock.yaml'
11+
- 'package.json'
12+
- 'tsconfig.base.json'
13+
- '.github/workflows/deploy-api.yml'
14+
workflow_dispatch:
15+
16+
concurrency:
17+
group: deploy-api
18+
cancel-in-progress: false
19+
20+
jobs:
21+
deploy:
22+
runs-on: ubuntu-latest
23+
environment: production
24+
env:
25+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
26+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- uses: pnpm/action-setup@v4
31+
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: 22
35+
cache: pnpm
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Type check API
41+
run: pnpm --filter @tecnova/api type-check
42+
43+
- name: Apply D1 migrations (remote)
44+
run: pnpm --filter @tecnova/api db:apply:remote
45+
46+
- name: Deploy to Cloudflare Workers
47+
run: pnpm --filter @tecnova/api deploy

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,33 @@ pnpm dev
162162

163163
---
164164

165+
## 🚢 Deployment / CI
166+
167+
- **フロントエンド (`apps/checkin`, `apps/admin`)** — Vercel が GitHub 連携で自動デプロイ。
168+
- **API (`apps/api`)** — GitHub Actions で `main` ブランチへの push をトリガに Cloudflare Workers へデプロイ。
169+
- ワークフロー: [`.github/workflows/deploy-api.yml`](./.github/workflows/deploy-api.yml)
170+
- 起動条件: `apps/api/**` / `packages/db/**` / `packages/shared/**` / ルート設定ファイルの変更
171+
- 手順: 依存解決 → 型チェック → D1 リモートマイグレーション適用 → `wrangler deploy`
172+
- **PR/main の lint + 型チェック**[`.github/workflows/ci.yml`](./.github/workflows/ci.yml)`biome check``turbo type-check` を実行。
173+
174+
### Required GitHub Secrets
175+
176+
リポジトリの Settings → Secrets and variables → Actions に以下を登録:
177+
178+
| 名前 | 用途 |
179+
| --- | --- |
180+
| `CLOUDFLARE_API_TOKEN` | Workers / D1 への deploy・migration 権限を持つ API トークン("Edit Cloudflare Workers" テンプレート + D1 Edit 権限) |
181+
| `CLOUDFLARE_ACCOUNT_ID` | Cloudflare Account ID |
182+
183+
Worker の Secrets(`GOOGLE_SERVICE_ACCOUNT_KEY` 等)は CI ではなく `wrangler secret put` で別途登録済み。
184+
185+
---
186+
165187
## 🗺️ Roadmap
166188

167189
- [x] 設計・要件定義
168190
- [ ] **Phase 1: MVPチェックインシステム**(運用開始対象)
169-
- [ ] モノレポ・CI/CD基盤構築
191+
- [x] モノレポ・CI/CD基盤構築
170192
- [ ] Drizzleスキーマ実装
171193
- [ ] Google Sheets API連携PoC
172194
- [ ] チェックインiPadアプリ

docs/handoff.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
- **Worker / admin / checkin はすでに本番デプロイ済みで、OAuth ログインまで含めて動作確認済み**
7575
(本番URLは memory `project_production_urls.md` 参照)
7676
- 本番反映済みコードのカットオフは PR #11 (commit `efc2075`)。以降の PR は次回デプロイ対象
77+
- **CI/CD 整備済み**`.github/workflows/`):
78+
- `ci.yml`:PR / main push で `biome check` + `turbo type-check`
79+
- `deploy-api.yml`:main push(`apps/api/**` ほか paths フィルタ)で D1 リモートマイグレーション → `wrangler deploy`
80+
- 必要 GitHub Secrets:`CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID`(未登録なら deploy job が失敗するので登録要)
7781

7882
---
7983

0 commit comments

Comments
 (0)