-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (105 loc) · 3.48 KB
/
deploy.yml
File metadata and controls
121 lines (105 loc) · 3.48 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
110
111
112
113
114
115
116
117
118
119
120
121
name: Deploy to Production
on:
push:
branches: [main, dev]
workflow_dispatch:
concurrency:
group: deploy-production
cancel-in-progress: false
jobs:
checks:
name: Checks
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: openlinear
POSTGRES_PASSWORD: openlinear
POSTGRES_DB: openlinear_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://openlinear:openlinear@localhost:5432/openlinear_test
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Generate Prisma client
run: pnpm --filter @openlinear/db db:generate
- name: Push schema to test database
run: pnpm --filter @openlinear/db db:push
- name: Typecheck
run: pnpm --filter @openlinear/api typecheck
continue-on-error: true
- name: Build API
run: pnpm --filter @openlinear/api build
continue-on-error: true
- name: Build Web
run: pnpm --filter @openlinear/desktop-ui build
continue-on-error: true
env:
NEXT_PUBLIC_API_URL: https://rixie.in
- name: Build Landing
run: pnpm --filter @openlinear/landing build
continue-on-error: true
- name: Test
run: pnpm --filter @openlinear/api test
continue-on-error: true
deploy:
name: Deploy
needs: checks
runs-on: ubuntu-latest
environment: production
steps:
- name: Deploy to droplet
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
command_timeout: 15m
script: |
set -e
export CI=true
cd /opt/openlinear && git reset --hard HEAD
/opt/openlinear/scripts/deploy.sh
- name: Diagnostics (pm2 + port + local health)
if: ${{ always() }}
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
command_timeout: 2m
script: |
set -e
echo "== pm2 show =="
pm2 show openlinear-api || true
pm2 show openlinear-web || true
echo "== port 3001 listener =="
(command -v ss >/dev/null 2>&1 && ss -ltnp | grep ':3001' && exit 0) || true
(command -v lsof >/dev/null 2>&1 && lsof -iTCP:3001 -sTCP:LISTEN -nP && exit 0) || true
echo "== localhost health =="
curl -sS -D- -o /dev/null --max-time 5 http://localhost:3001/health || true
echo "== localhost web =="
curl -sS -D- -o /dev/null --max-time 10 http://localhost:3000/ || true
- name: Verify deployment
run: |
sleep 30
HTTP_STATUS=$(curl -s -o /dev/null -w '%{http_code}' https://rixie.in/health)
if [ "$HTTP_STATUS" = "200" ]; then
echo "✓ Deployment verified — health check returned $HTTP_STATUS"
else
echo "✗ Health check failed — returned $HTTP_STATUS"
exit 1
fi