π Deploy - Demos #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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!" |