-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 2.61 KB
/
deploy.yml
File metadata and controls
99 lines (84 loc) · 2.61 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
name: 🚀 Deploy - Production
on:
push:
branches: [main]
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
required: true
default: 'production'
type: choice
options:
- production
- staging
env:
NODE_VERSION: '20.x'
jobs:
# ============================================
# PRE-DEPLOY CHECKS
# ============================================
pre-deploy:
name: ✅ Pre-Deploy Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run type-check
- name: Run tests
run: npm run test
# ============================================
# DEPLOY TO VERCEL
# ============================================
deploy:
name: 🚀 Deploy to Vercel
runs-on: ubuntu-latest
needs: [pre-deploy]
environment:
name: ${{ github.event.inputs.environment || 'production' }}
url: https://progresstracker.vercel.app
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install Vercel CLI
run: npm install -g vercel
- name: Deploy to Vercel (Production)
if: github.event.inputs.environment == 'production' || github.event.inputs.environment == ''
run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Deploy to Vercel (Staging)
if: github.event.inputs.environment == 'staging'
run: vercel deploy --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
# ============================================
# POST-DEPLOY
# ============================================
post-deploy:
name: 🔍 Post-Deploy Verification
runs-on: ubuntu-latest
needs: [deploy]
steps:
- name: Health check
run: |
sleep 30
curl -f https://progresstracker.vercel.app/api/health || exit 1
- name: Notify deployment
if: always()
run: echo "Deployment completed with status ${{ job.status }}"