-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (59 loc) · 2.01 KB
/
deploy-website.yml
File metadata and controls
70 lines (59 loc) · 2.01 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
name: Deploy Website to Vercel
on:
push:
branches:
- main
paths:
- 'website/**'
- '.github/workflows/deploy-website.yml'
pull_request:
paths:
- 'website/**'
- '.github/workflows/deploy-website.yml'
workflow_dispatch:
concurrency:
group: deploy-website-${{ github.ref }}
cancel-in-progress: true
env:
VERCEL_ORG_ID: team_Twwa0KDaGtEybSu6BXtGJZoD
VERCEL_PROJECT_ID: prj_0B3eVoAJ5vAKY5yL8CH8cJl8JULp
jobs:
deploy:
name: Deploy (${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'production' || 'preview' }})
runs-on: ubuntu-latest
defaults:
run:
working-directory: website
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: website/package-lock.json
- name: Install dependencies
run: npm ci
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Set deployment environment
id: env
run: |
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "target=production" >> "$GITHUB_OUTPUT"
echo "prod_flag=--prod" >> "$GITHUB_OUTPUT"
else
echo "target=preview" >> "$GITHUB_OUTPUT"
echo "prod_flag=" >> "$GITHUB_OUTPUT"
fi
- name: Pull Vercel environment
run: vercel pull --yes --environment=${{ steps.env.outputs.target }} --token=${{ secrets.VERCEL_TOKEN }}
- name: Build with Vercel
run: vercel build ${{ steps.env.outputs.prod_flag }} --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy to Vercel
id: deploy
run: |
url=$(vercel deploy --prebuilt ${{ steps.env.outputs.prod_flag }} --token=${{ secrets.VERCEL_TOKEN }})
echo "url=$url" >> "$GITHUB_OUTPUT"
echo "Deployed to: $url" >> "$GITHUB_STEP_SUMMARY"