single cloudflare workers deployment #125
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
| on: | |
| - push | |
| - pull_request | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Migrate database | |
| run: pnpm dlx wrangler d1 migrations apply DB --local | |
| - name: Lint | |
| working-directory: ./worker | |
| run: pnpm run lint | |
| - name: Test | |
| working-directory: ./worker | |
| run: pnpm run test | |
| deploy: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: | | |
| pnpm install | |
| pnpm add --global wrangler | |
| - name: Build frontend | |
| working-directory: ./app | |
| run: pnpm build | |
| - name: Publish | |
| run: | | |
| pnpm dlx wrangler d1 migrations apply DB --env production --remote | |
| pnpm dlx wrangler deploy --env production | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }} |