11name : Deploy - Demos
22run-name : ${{ github.ref_name == 'main' && '🚀' || '🧪' }} Deploy - Demos
3+
34env :
45 VERCEL_ORG_ID : ${{ secrets.VERCEL_ORG_ID }}
56 VERCEL_PROJECT_ID : ${{ secrets.VERCEL_PROJECT_ID }}
89 workflow_dispatch :
910
1011jobs :
11- deployment :
12+ deploy :
1213 runs-on : ubuntu-latest
1314 steps :
14- - name : ⚙️ Setup pnpm
15- uses : pnpm/action-setup@v4
16- with :
17- version : 9
18-
1915 - name : ⬇️ Checkout current repo
2016 uses : actions/checkout@v4
2117 with :
22- path : shadcn-studio/${{ github.event.repository.name }}
18+ path : shadcn-studio/template
2319
2420 - name : ⬇️ Checkout automation-scripts repo
2521 uses : actions/checkout@v4
@@ -28,18 +24,47 @@ jobs:
2824 token : ${{ secrets.GH_PAT }}
2925 path : automation-scripts
3026
27+ - name : 📦 Setup pnpm
28+ uses : pnpm/action-setup@v4
29+ with :
30+ version : latest
3131 - name : ⬇️ Install packages in automation-scripts dir
32- working-directory : automation-scripts/nextjs
33- run : pnpm i
32+ working-directory : automation-scripts/astro
33+ run : pnpm install
34+
35+ - name : 📦 Install template dependencies
36+ working-directory : shadcn-studio/template
37+ run : pnpm install
3438
35- - name : ⬇️ Install packages in current repo
36- working-directory : shadcn-studio/${{ github.event.repository.name }}
37- run : pnpm i
39+ - name : 🏗️ Build with automation script
40+ working-directory : automation-scripts/astro
41+ run : |
42+ echo "🔧 Building Astro template..."
43+ echo "Repository: ${{ github.repository }}"
44+ echo "Branch: ${{ github.ref_name }}"
45+ echo "Environment: ${{ github.ref_name == 'main' && 'Production 🚀' || 'Preview 🧪' }}"
3846
39- - name : 📦 Build
40- working-directory : automation-scripts/nextjs
41- run : pnpm install vercel && pnpm tsx ./src/shadcn-studio/template/generateBuild.ts $([[ "${{ github.ref_name == 'main' }}" == "true" ]] && echo --prod) -- vercel-token ${{ secrets.VERCEL_TOKEN }} --repo-name ${{ github.event.repository.name }}
47+ pnpm tsx ./src/shadcn-studio/template/generateBuild.ts \
48+ $([[ "${{ github.ref_name }}" == "main" ]] && echo "--prod") \
49+ -- vercel-token ${{ secrets.VERCEL_TOKEN }}
4250
4351 - name : 🚀 Deploy to Vercel
44- working-directory : shadcn-studio/${{ github.event.repository.name }}
45- run : pnpm install -w vercel && pnpm exec vercel $([[ "${{ github.ref_name == 'main' }}" == "true" ]] && echo --prod) --prebuilt --token ${{ secrets.VERCEL_TOKEN }}
52+ working-directory : shadcn-studio/template
53+ run : |
54+ # Install Vercel CLI globally
55+ pnpm add -g vercel@latest
56+
57+ # Link to Vercel project
58+ echo "🔗 Linking to Vercel project..."
59+ vercel link --yes --token ${{ secrets.VERCEL_TOKEN }}
60+
61+ # Deploy based on branch
62+ if [[ "${{ github.ref_name }}" == "main" ]]; then
63+ echo "🚀 Deploying to Production..."
64+ vercel deploy --prod --prebuilt --token ${{ secrets.VERCEL_TOKEN }} --yes
65+ else
66+ echo "🧪 Deploying to Preview (${{ github.ref_name }})..."
67+ vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }} --yes
68+ fi
69+
70+ echo "✅ Deployment completed successfully!"
0 commit comments