Skip to content

πŸš€ Deploy - Demos #13

πŸš€ Deploy - Demos

πŸš€ Deploy - Demos #13

Workflow file for this run

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!"