-
Notifications
You must be signed in to change notification settings - Fork 258
76 lines (64 loc) · 2.56 KB
/
deploy-web.yml
File metadata and controls
76 lines (64 loc) · 2.56 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
name: Deploy Web
on:
push:
branches: [main]
paths:
- "packages/web/**"
- "packages/shared/**"
- ".github/workflows/deploy-web.yml"
workflow_dispatch: # Allow manual trigger
permissions:
contents: read
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_TEAM_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs:
deploy:
name: Deploy to Vercel
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if secrets are configured
id: check-secrets
run: |
# Skip if web_platform is set to something other than vercel
WEB_PLATFORM="${{ secrets.WEB_PLATFORM }}"
if [ -n "$WEB_PLATFORM" ] && [ "$WEB_PLATFORM" != "vercel" ]; then
echo "Skipping Vercel deployment - web_platform is '${WEB_PLATFORM}'"
echo "configured=false" >> $GITHUB_OUTPUT
elif [ -z "${{ secrets.VERCEL_API_TOKEN }}" ] || [ -z "${{ secrets.VERCEL_PROJECT_ID }}" ]; then
echo "Skipping deployment - Vercel secrets not configured"
echo "configured=false" >> $GITHUB_OUTPUT
else
echo "configured=true" >> $GITHUB_OUTPUT
fi
- name: Checkout
if: steps.check-secrets.outputs.configured == 'true'
uses: actions/checkout@v6
- name: Setup Node.js
if: steps.check-secrets.outputs.configured == 'true'
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
if: steps.check-secrets.outputs.configured == 'true'
run: npm ci
- name: Build shared package
if: steps.check-secrets.outputs.configured == 'true'
run: npm run build -w @open-inspect/shared
- name: Install Vercel CLI
if: steps.check-secrets.outputs.configured == 'true'
run: npm install -g vercel
- name: Pull Vercel Environment
if: steps.check-secrets.outputs.configured == 'true'
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_API_TOKEN }}
- name: Build Project
if: steps.check-secrets.outputs.configured == 'true'
run: vercel build --prod --token=${{ secrets.VERCEL_API_TOKEN }}
env:
# Required for NextAuth static generation - set via GitHub secret or Vercel will provide
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL || 'https://localhost:3000' }}
- name: Deploy to Vercel
if: steps.check-secrets.outputs.configured == 'true'
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_API_TOKEN }}