-
Notifications
You must be signed in to change notification settings - Fork 267
109 lines (93 loc) · 3.08 KB
/
Copy pathdeploy.yml
File metadata and controls
109 lines (93 loc) · 3.08 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Deploy to Production
on:
push:
branches: [main, master]
workflow_dispatch:
inputs:
error_budget:
description: 'Maximum tolerable error budget ratio (e.g. 0.05 for 5%)'
required: false
default: '0.05'
iterations:
description: 'Number of canary probe rounds'
required: false
default: '5'
skip_canary:
description: 'Skip canary rollout (emergency rollback only)'
required: false
default: false
type: boolean
jobs:
canary-rollout:
name: Canary API Rollout & Health Probes
runs-on: ubuntu-latest
if: ${{ github.event.inputs.skip_canary != 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Start Redis and Canary API container
run: |
docker compose --profile canary up -d --build redis api-canary
echo "Waiting for services to become healthy..."
for i in {1..30}; do
if docker compose ps api-canary | grep -q "(healthy)"; then
echo "Canary API container is healthy!"
break
fi
sleep 2
done
- name: Execute Canary Health Probes with Error Budget Gate
run: |
pnpm run canary:probe -- \
--url=http://localhost:4001 \
--error-budget=${{ github.event.inputs.error_budget || '0.05' }} \
--iterations=${{ github.event.inputs.iterations || '5' }} \
--interval-ms=1000 \
--env=canary \
--abort-command="docker compose stop api-canary"
- name: Tear down canary containers
if: always()
run: docker compose --profile canary down
deploy:
name: Deploy Production Bundle
runs-on: ubuntu-latest
needs: [canary-rollout]
if: ${{ always() && (needs.canary-rollout.result == 'success' || needs.canary-rollout.result == 'skipped') }}
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build project
run: pnpm run build
env:
NEXT_PUBLIC_STELLAR_NETWORK: ${{ secrets.STELLAR_NETWORK }}
- name: Deploy to Vercel
uses: amondnet/vercel-action@v42
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-args: '--prod'