|
1 | 1 | name: Deploy - Demos |
2 | 2 | run-name: ${{ github.ref_name == 'main' && '🚀' || '🧪' }} Deploy - Demos |
3 | | - |
4 | 3 | env: |
5 | 4 | VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} |
6 | 5 | VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} |
|
9 | 8 | workflow_dispatch: |
10 | 9 |
|
11 | 10 | jobs: |
12 | | - deploy: |
| 11 | + deployment: |
13 | 12 | runs-on: ubuntu-latest |
14 | 13 | steps: |
15 | | - - name: 📥 Checkout code |
16 | | - uses: actions/checkout@v4 |
17 | | - |
18 | | - - name: 📦 Setup pnpm |
| 14 | + - name: ⚙️ Setup pnpm |
19 | 15 | uses: pnpm/action-setup@v4 |
20 | 16 | with: |
21 | | - version: latest |
| 17 | + version: 9 |
22 | 18 |
|
23 | | - - name: 📦 Setup Node.js |
24 | | - uses: actions/setup-node@v4 |
| 19 | + - name: ⬇️ Checkout current repo |
| 20 | + uses: actions/checkout@v4 |
25 | 21 | with: |
26 | | - node-version: '22' |
27 | | - cache: 'pnpm' |
28 | | - |
29 | | - - name: 📦 Install dependencies |
30 | | - run: pnpm install --frozen-lockfile |
31 | | - |
32 | | - - name: 🤖 Configure for demo deployment |
33 | | - run: | |
34 | | - echo "🤖 Configuring site for demo deployment..." |
35 | | -
|
36 | | - # Set production site URL |
37 | | - SITE_URL="https://shadcn-astro-track-landing-page.vercel.app/" |
38 | | - echo "🌐 Setting site URL to: $SITE_URL" |
39 | | -
|
40 | | - # Update astro.config.mjs site URL |
41 | | - sed -i.bak "s|site: 'http://localhost:4321/'|site: '$SITE_URL'|g" astro.config.mjs |
42 | | -
|
43 | | - # Update all localhost URLs in astro.config.mjs (for sitemap) |
44 | | - sed -i.bak "s|http://localhost:4321/|$SITE_URL|g" astro.config.mjs |
45 | | -
|
46 | | - # Update SITE_URL in consts.ts |
47 | | - sed -i.bak "s|export const SITE_URL = 'https://shadcnstudio.com/'|export const SITE_URL = '$SITE_URL'|g" src/consts.ts |
48 | | -
|
49 | | - # Update robots.txt sitemap URL reference if present |
50 | | - sed -i.bak "s|https://yourdomain.com/|$SITE_URL|g" public/robots.txt |
51 | | -
|
52 | | - # Update consts.ts to set robots to noindex, nofollow (temporary, only in CI) |
53 | | - sed -i.bak "s/index: true/index: false/g" src/consts.ts |
54 | | - sed -i.bak "s/follow: true/follow: false/g" src/consts.ts |
55 | | -
|
56 | | - # Replace robots.txt with demo version (temporary, only in CI) |
57 | | - cat > public/robots.txt << 'ROBOTS' |
58 | | - # robots.txt for Demo/Staging Environment |
59 | | - # Automatically generated during deployment to prevent indexing |
60 | | -
|
61 | | - User-agent: * |
62 | | - Disallow: / |
| 22 | + path: shadcn-studio/${{ github.event.repository.name }} |
63 | 23 |
|
64 | | - # Block all major search engines |
65 | | - User-agent: Googlebot |
66 | | - Disallow: / |
67 | | -
|
68 | | - User-agent: Bingbot |
69 | | - Disallow: / |
70 | | -
|
71 | | - User-agent: Slurp |
72 | | - Disallow: / |
73 | | -
|
74 | | - User-agent: DuckDuckBot |
75 | | - Disallow: / |
76 | | -
|
77 | | - User-agent: Baiduspider |
78 | | - Disallow: / |
79 | | -
|
80 | | - User-agent: YandexBot |
81 | | - Disallow: / |
82 | | - ROBOTS |
83 | | -
|
84 | | - echo "✅ Configuration updated (temporary for this deployment only)" |
85 | | - echo "📄 Verifying configurations:" |
86 | | - echo "Site URL in astro.config.mjs:" |
87 | | - grep "site:" astro.config.mjs || echo "URL applied" |
88 | | - echo "Site URL in consts.ts:" |
89 | | - grep "SITE_URL" src/consts.ts || echo "URL applied" |
90 | | -
|
91 | | - - name: 🏗️ Build Astro project |
92 | | - run: pnpm run build |
93 | | - |
94 | | - - name: 📦 Prepare Vercel prebuilt output |
95 | | - run: | |
96 | | - echo "📦 Creating Vercel Build Output API structure..." |
97 | | -
|
98 | | - # Create .vercel/output directory structure |
99 | | - mkdir -p .vercel/output/static |
| 24 | + - name: ⬇️ Checkout automation-scripts repo |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + repository: themeselection/automation-scripts |
| 28 | + token: ${{ secrets.GH_PAT }} |
| 29 | + path: automation-scripts |
100 | 30 |
|
101 | | - # Copy all build files to static directory |
102 | | - cp -r dist/* .vercel/output/static/ |
| 31 | + - name: ⬇️ Install packages in automation-scripts dir |
| 32 | + working-directory: automation-scripts/nextjs |
| 33 | + run: pnpm i |
103 | 34 |
|
104 | | - # Create config.json for Vercel Build Output API v3 |
105 | | - cat > .vercel/output/config.json << 'EOF' |
106 | | - { |
107 | | - "version": 3, |
108 | | - "routes": [ |
109 | | - { |
110 | | - "handle": "filesystem" |
111 | | - } |
112 | | - ] |
113 | | - } |
114 | | - EOF |
| 35 | + - name: ⬇️ Install packages in current repo |
| 36 | + working-directory: shadcn-studio/${{ github.event.repository.name }} |
| 37 | + run: pnpm i |
115 | 38 |
|
116 | | - echo "✅ Vercel prebuilt output ready" |
117 | | - echo "📁 Output structure:" |
118 | | - ls -la .vercel/output/ |
119 | | - echo "📄 Files in static:" |
120 | | - ls -la .vercel/output/static/ | head -10 |
| 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 }} |
121 | 42 |
|
122 | 43 | - name: 🚀 Deploy to Vercel |
123 | | - run: | |
124 | | - # Install Vercel CLI |
125 | | - pnpm add -g vercel@latest |
126 | | -
|
127 | | - # Link to Vercel project |
128 | | - echo "🔗 Linking to Vercel project..." |
129 | | - pnpm exec vercel link --yes --token ${{ secrets.VERCEL_TOKEN }} |
130 | | -
|
131 | | - # Deploy based on branch |
132 | | - if [[ "${{ github.ref_name }}" == "main" ]]; then |
133 | | - echo "🚀 Deploying to Production..." |
134 | | - pnpm exec vercel deploy --prod --prebuilt --token ${{ secrets.VERCEL_TOKEN }} --yes |
135 | | - else |
136 | | - echo "🧪 Deploying to Preview (${{ github.ref_name }})..." |
137 | | - pnpm exec vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }} --yes |
138 | | - fi |
139 | | -
|
140 | | - echo "✅ Deployment completed successfully!" |
| 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 }} |
0 commit comments