-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (65 loc) · 2.47 KB
/
Copy pathdeploy.yml
File metadata and controls
75 lines (65 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Deploy
# Runs after CI succeeds on main. Deploys web + server + D1 to Cloudflare via
# Alchemy. Resources use `adopt: true`, so the runner reconciles the live
# resources without sharing the local Alchemy state file.
on:
workflow_run:
workflows: ["CI"]
branches: [main]
types:
- completed
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
concurrency:
group: deploy
cancel-in-progress: true
jobs:
deploy:
name: Deploy to Cloudflare
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2.1.3
with:
bun-version-file: package.json
- name: Cache bun install
uses: actions/cache@v5
with:
path: ~/.bun/install/cache
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-${{ runner.os }}-
- name: Cache Next.js build
uses: actions/cache@v5
with:
path: apps/web/.next/cache
key: nextjs-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
nextjs-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Deploy (Alchemy → Cloudflare)
# `bun run deploy` runs `tsx alchemy.run.ts` under Node — Bun segfaults
# executing the Alchemy program, so it must not run under Bun.
run: bun run deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
ALCHEMY_PASSWORD: ${{ secrets.ALCHEMY_PASSWORD }}
# All resources are fixed + adopt:true, so a per-run ephemeral state
# store is safe (nothing dynamic to orphan). Opt out of Alchemy's
# CI state-store guard.
ALCHEMY_CI_STATE_STORE_CHECK: "false"
# Cloudflare Access — set these as repo secrets to enforce /control
# protection in production (empty = fails closed).
CF_ACCESS_TEAM_DOMAIN: ${{ secrets.CF_ACCESS_TEAM_DOMAIN }}
CF_ACCESS_AUD: ${{ secrets.CF_ACCESS_AUD }}
- name: Smoke test API
run: |
sleep 5
OUT=$(curl -sf https://wolfathon-api.mrdemonwolf.workers.dev/ || echo FAILED)
echo "API root: $OUT"
echo "$OUT" | grep -q "OK" || { echo "ERROR: API smoke test failed"; exit 1; }