-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (59 loc) · 2.18 KB
/
deploy.yml
File metadata and controls
72 lines (59 loc) · 2.18 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
name: CD
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
jobs:
deploy:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Build
run: npm run build
- name: Run D1 Migrations
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: npx wrangler d1 migrations apply openboot --remote
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Health Check
run: |
echo "Waiting 10 seconds for deployment to propagate..."
sleep 10
echo "Running health check..."
HEALTH_RESPONSE=$(curl -s https://openboot.dev/api/health)
echo "Health check response: $HEALTH_RESPONSE"
STATUS=$(echo $HEALTH_RESPONSE | jq -r '.status')
if [ "$STATUS" != "healthy" ]; then
echo "Health check failed! Status: $STATUS"
echo "Full response: $HEALTH_RESPONSE"
exit 1
fi
echo "Health check passed!"
echo "API: $(echo $HEALTH_RESPONSE | jq -r '.checks.api')"
echo "Database: $(echo $HEALTH_RESPONSE | jq -r '.checks.database')"
echo "Version: $(echo $HEALTH_RESPONSE | jq -r '.version')"
- name: Post-deploy smoke test
run: ./scripts/smoke-test-api.sh https://openboot.dev
- name: Post-deploy contract validation
run: |
pip install jsonschema
git clone --depth 1 https://github.com/openbootdotdev/openboot-contract.git /tmp/contract
SERVER_URL=https://openboot.dev /tmp/contract/golden-path/contract-smoke.sh