-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (90 loc) · 3.36 KB
/
Copy pathdeploy.yml
File metadata and controls
101 lines (90 loc) · 3.36 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
name: CI / Deploy
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
typecheck:
name: TypeScript check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: "24"
cache: "npm"
cache-dependency-path: |
backend/package-lock.json
frontend/package-lock.json
- name: Show runtime versions
run: |
node --version
npm --version
# BACKEND
- name: Install backend deps
working-directory: ./backend
run: npm ci
- name: Typecheck backend
working-directory: ./backend
run: npm run typecheck
- name: Test backend
working-directory: ./backend
run: npm test
# FRONTEND
- name: Install frontend deps
working-directory: ./frontend
run: npm ci
- name: Typecheck frontend
working-directory: ./frontend
run: npm run typecheck
- name: Lint frontend
working-directory: ./frontend
run: npm run lint
- name: Build frontend
working-directory: ./frontend
run: npm run build
deploy-backend:
name: Deploy to Render
needs: typecheck
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Trigger Render deploy hook
run: curl -fsSL -X POST "${{ secrets.RENDER_DEPLOY_HOOK_URL }}"
deploy-frontend:
name: Deploy to Vercel
needs: typecheck
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: "24"
- name: Install Vercel CLI
run: npm install --global vercel@59.13.1
- name: Validate Vercel credentials
run: |
if [[ -z "$VERCEL_TOKEN" ]]; then
echo "::error::The VERCEL_TOKEN GitHub Actions secret is missing."
exit 1
fi
if [[ -z "$VERCEL_ORG_ID" ]]; then
echo "::error::The VERCEL_ORG_ID GitHub Actions secret is missing."
exit 1
fi
if [[ -z "$VERCEL_PROJECT_ID" ]]; then
echo "::error::The VERCEL_PROJECT_ID GitHub Actions secret is missing."
exit 1
fi
- name: Pull Vercel production configuration
run: vercel pull --yes --environment=production --token="$VERCEL_TOKEN"
- name: Build Vercel artifacts
run: vercel build --prod --token="$VERCEL_TOKEN"
- name: Deploy Vercel artifacts
run: vercel deploy --prebuilt --prod --token="$VERCEL_TOKEN"