Merge pull request #196 from jphacks:ekekekek #70
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Cloudflare | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: # 手動トリガーを許可 | |
| jobs: | |
| # まずテストを実行 | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.12.3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install frontend dependencies | |
| run: pnpm install --frozen-lockfile | |
| working-directory: ./frontend | |
| - name: Run frontend tests | |
| run: pnpm test | |
| working-directory: ./frontend | |
| - name: Build frontend | |
| run: pnpm build | |
| working-directory: ./frontend | |
| # テスト成功後にバックエンドをデプロイ | |
| deploy-backend: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| name: Deploy Backend to Cloudflare Workers | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.12.3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| env: | |
| NODE_OPTIONS: "--max-old-space-size=4096" | |
| - name: Generate Prisma Client | |
| run: pnpm prisma:generate | |
| - name: Type check | |
| run: pnpm exec tsc --noEmit | |
| - name: Deploy to Cloudflare Workers | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: "backend" | |
| packageManager: "pnpm" | |
| # フロントエンドのデプロイ(Vercelなどを使用する場合) | |
| # deploy-frontend: | |
| # needs: test | |
| # runs-on: ubuntu-latest | |
| # name: Deploy Frontend | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # # Vercel, Netlify, または他のホスティングサービスへのデプロイステップ |