-
Notifications
You must be signed in to change notification settings - Fork 6
140 lines (108 loc) Β· 4.38 KB
/
deploy.yml
File metadata and controls
140 lines (108 loc) Β· 4.38 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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 code
uses: actions/checkout@v4
- name: π¦ Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: π¦ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: π¦ Install dependencies
run: pnpm install --frozen-lockfile
- name: π€ Configure for demo deployment
run: |
echo "π€ Configuring site for demo deployment..."
# Set production site URL
SITE_URL="https://shadcn-astro-ink-landing-page.vercel.app/"
echo "π Setting site URL to: $SITE_URL"
# Update astro.config.mjs site URL
sed -i.bak "s|site: 'http://localhost:4321/'|site: '$SITE_URL'|g" astro.config.mjs
# Update all localhost URLs in astro.config.mjs (for sitemap)
sed -i.bak "s|http://localhost:4321/|$SITE_URL|g" astro.config.mjs
# Update SITE_URL in consts.ts
sed -i.bak "s|export const SITE_URL = 'https://shadcnstudio.com/'|export const SITE_URL = '$SITE_URL'|g" src/consts.ts
# Update robots.txt sitemap URL reference if present
sed -i.bak "s|https://yourdomain.com/|$SITE_URL|g" public/robots.txt
# Update consts.ts to set robots to noindex, nofollow (temporary, only in CI)
sed -i.bak "s/index: true/index: false/g" src/consts.ts
sed -i.bak "s/follow: true/follow: false/g" src/consts.ts
# Replace robots.txt with demo version (temporary, only in CI)
cat > public/robots.txt << 'ROBOTS'
# robots.txt for Demo/Staging Environment
# Automatically generated during deployment to prevent indexing
User-agent: *
Disallow: /
# Block all major search engines
User-agent: Googlebot
Disallow: /
User-agent: Bingbot
Disallow: /
User-agent: Slurp
Disallow: /
User-agent: DuckDuckBot
Disallow: /
User-agent: Baiduspider
Disallow: /
User-agent: YandexBot
Disallow: /
ROBOTS
echo "β
Configuration updated (temporary for this deployment only)"
echo "π Verifying configurations:"
echo "Site URL in astro.config.mjs:"
grep "site:" astro.config.mjs || echo "URL applied"
echo "Site URL in consts.ts:"
grep "SITE_URL" src/consts.ts || echo "URL applied"
- name: ποΈ Build Astro project
run: pnpm run build
- name: π¦ Prepare Vercel prebuilt output
run: |
echo "π¦ Creating Vercel Build Output API structure..."
# Create .vercel/output directory structure
mkdir -p .vercel/output/static
# Copy all build files to static directory
cp -r dist/* .vercel/output/static/
# Create config.json for Vercel Build Output API v3
cat > .vercel/output/config.json << 'EOF'
{
"version": 3,
"routes": [
{
"handle": "filesystem"
}
]
}
EOF
echo "β
Vercel prebuilt output ready"
echo "π Output structure:"
ls -la .vercel/output/
echo "π Files in static:"
ls -la .vercel/output/static/ | head -10
- name: π Deploy to Vercel
run: |
# Install Vercel CLI
pnpm add -g vercel@latest
# Link to Vercel project
echo "π Linking to Vercel project..."
pnpm exec vercel link --yes --token ${{ secrets.VERCEL_TOKEN }}
# Deploy based on branch
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "π Deploying to Production..."
pnpm exec vercel deploy --prod --prebuilt --token ${{ secrets.VERCEL_TOKEN }} --yes
else
echo "π§ͺ Deploying to Preview (${{ github.ref_name }})..."
pnpm exec vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }} --yes
fi
echo "β
Deployment completed successfully!"