-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (58 loc) · 2.34 KB
/
deploy.yml
File metadata and controls
70 lines (58 loc) · 2.34 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 - Demos
run-name: ${{ github.ref_name == 'main' && '🚀' || '🧪' }} Deploy - Demos
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout current repo
uses: actions/checkout@v4
with:
path: shadcn-studio/template
- name: ⬇️ Checkout automation-scripts repo
uses: actions/checkout@v4
with:
repository: themeselection/automation-scripts
token: ${{ secrets.GH_PAT }}
path: automation-scripts
- name: 📦 Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: ⬇️ Install packages in automation-scripts dir
working-directory: automation-scripts/astro
run: pnpm install
- name: 📦 Install template dependencies
working-directory: shadcn-studio/template
run: pnpm install
- name: 🏗️ Build with automation script
working-directory: automation-scripts/astro
run: |
echo "🔧 Building Astro template..."
echo "Repository: ${{ github.repository }}"
echo "Branch: ${{ github.ref_name }}"
echo "Environment: ${{ github.ref_name == 'main' && 'Production 🚀' || 'Preview 🧪' }}"
pnpm tsx ./src/shadcn-studio/template/generateBuild.ts \
$([[ "${{ github.ref_name }}" == "main" ]] && echo "--prod") \
--vercel-token ${{ secrets.VERCEL_TOKEN }}
- name: 🚀 Deploy to Vercel
working-directory: shadcn-studio/template
run: |
# Install Vercel CLI globally
pnpm add -g vercel@latest
# Link to Vercel project
echo "🔗 Linking to Vercel project..."
vercel link --yes --token ${{ secrets.VERCEL_TOKEN }}
# Deploy based on branch
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "🚀 Deploying to Production..."
vercel deploy --prod --prebuilt --token ${{ secrets.VERCEL_TOKEN }} --yes
else
echo "🧪 Deploying to Preview (${{ github.ref_name }})..."
vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }} --yes
fi
echo "✅ Deployment completed successfully!"