Skip to content

Commit 68689d7

Browse files
author
Deepak Pandey
committed
fix: Remove --prebuilt flag and improve health checks
- Remove --prebuilt flag from both staging and production deployments - Let Vercel handle the build process during deployment (simpler approach) - Update health checks to test actual deployment URLs first - Add fallback to test production/staging domains if deployment URL fails - This resolves the prebuilt environment mismatch and health check failures
1 parent 60dc80e commit 68689d7

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

.github/workflows/ci-cd.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ jobs:
315315
- name: Deploy to Vercel (Staging)
316316
id: deploy-staging
317317
run: |
318-
DEPLOYMENT_URL=$(vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }} --yes)
318+
DEPLOYMENT_URL=$(vercel deploy --token ${{ secrets.VERCEL_TOKEN }} --yes)
319319
echo "deployment-url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
320320
echo "🚀 Staging deployment URL: $DEPLOYMENT_URL"
321321
env:
@@ -327,12 +327,20 @@ jobs:
327327
echo "⏳ Waiting for deployment to be ready..."
328328
sleep 30
329329
echo "🔍 Testing health endpoint..."
330-
if curl -f -s --max-time 30 "${{ secrets.STAGING_URL }}/api/health"; then
330+
DEPLOYMENT_URL="${{ steps.deploy-staging.outputs.deployment-url }}"
331+
echo "Testing URL: $DEPLOYMENT_URL/api/health"
332+
if curl -f -s --max-time 30 "$DEPLOYMENT_URL/api/health"; then
331333
echo "✅ Staging health check passed"
332334
else
333335
echo "❌ Staging health check failed"
334-
echo "Deployment URL: ${{ steps.deploy-staging.outputs.deployment-url }}"
335-
exit 1
336+
echo "Deployment URL: $DEPLOYMENT_URL"
337+
echo "Trying staging domain instead..."
338+
if curl -f -s --max-time 30 "${{ secrets.STAGING_URL }}/api/health"; then
339+
echo "✅ Staging domain health check passed"
340+
else
341+
echo "❌ Both deployment URL and staging domain failed"
342+
exit 1
343+
fi
336344
fi
337345
338346
# Deploy to Production
@@ -399,7 +407,7 @@ jobs:
399407
- name: Deploy to Vercel (Production)
400408
id: deploy-production
401409
run: |
402-
DEPLOYMENT_URL=$(vercel deploy --prebuilt --prod --token ${{ secrets.VERCEL_TOKEN }} --yes)
410+
DEPLOYMENT_URL=$(vercel deploy --prod --token ${{ secrets.VERCEL_TOKEN }} --yes)
403411
echo "deployment-url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
404412
echo "🚀 Production deployment URL: $DEPLOYMENT_URL"
405413
env:
@@ -411,12 +419,20 @@ jobs:
411419
echo "⏳ Waiting for production deployment to be ready..."
412420
sleep 30
413421
echo "🔍 Testing production health endpoint..."
414-
if curl -f -s --max-time 30 "${{ secrets.PRODUCTION_URL }}/api/health"; then
422+
DEPLOYMENT_URL="${{ steps.deploy-production.outputs.deployment-url }}"
423+
echo "Testing URL: $DEPLOYMENT_URL/api/health"
424+
if curl -f -s --max-time 30 "$DEPLOYMENT_URL/api/health"; then
415425
echo "✅ Production health check passed"
416426
else
417427
echo "❌ Production health check failed"
418-
echo "Deployment URL: ${{ steps.deploy-production.outputs.deployment-url }}"
419-
exit 1
428+
echo "Deployment URL: $DEPLOYMENT_URL"
429+
echo "Trying production domain instead..."
430+
if curl -f -s --max-time 30 "${{ secrets.PRODUCTION_URL }}/api/health"; then
431+
echo "✅ Production domain health check passed"
432+
else
433+
echo "❌ Both deployment URL and production domain failed"
434+
exit 1
435+
fi
420436
fi
421437
422438
- name: Notify deployment success via email

0 commit comments

Comments
 (0)