1212 required : false
1313 default : false
1414 type : boolean
15+ deploy_to_vercel :
16+ description : ' Deploy to Vercel (only for testing)'
17+ required : false
18+ default : false
19+ type : boolean
1520
1621# Add permissions for CodeQL/SARIF upload
1722permissions :
@@ -313,11 +318,11 @@ jobs:
313318 # ============================================================================
314319 # 6. RAILWAY DEPLOYMENT (Production Only)
315320 # ============================================================================
316- railway -deployment :
317- name : 🚀 Railway Production Deployment
321+ vercel -deployment :
322+ name : 🚀 Vercel Production Deployment
318323 runs-on : ubuntu-latest
319324 needs : [pre-deployment]
320- if : (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event.inputs.deploy_to_railway == 'true'
325+ if : (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event.inputs.deploy_to_vercel == 'true'
321326 environment :
322327 name : production
323328 url : ${{ steps.deploy.outputs.url }}
@@ -326,105 +331,98 @@ jobs:
326331 - name : 📥 Checkout Repository
327332 uses : actions/checkout@v4
328333
329- - name : 🐍 Setup Node.js for Railway CLI
334+ - name : 🟢 Setup Node.js for Vercel CLI
330335 uses : actions/setup-node@v4
331336 with :
332337 node-version : ${{ env.NODE_VERSION }}
333338
334- - name : 🚂 Deploy to Railway
339+ - name : 🚀 Deploy to Vercel
335340 id : deploy
336341 env :
337- RAILWAY_TOKEN : ${{ secrets.RAILWAY_TOKEN }}
342+ VERCEL_TOKEN : ${{ secrets.VERCEL_TOKEN }}
343+ VERCEL_ORG_ID : ${{ secrets.VERCEL_ORG_ID }}
344+ VERCEL_PROJECT_ID : ${{ secrets.VERCEL_PROJECT_ID }}
338345 run : |
339- echo "🚀 Starting Railway deployment process..."
340-
341- # Method 1: Try npm installation first (most reliable)
342- echo "📦 Installing Railway CLI via npm..."
343- npm install -g @railway/cli || {
344- echo "❌ npm installation failed, trying alternative method..."
345-
346- # Method 2: Download from GitHub releases with better error handling
347- echo "⬇️ Downloading Railway CLI from GitHub releases..."
348- RAILWAY_VERSION="v3.17.1"
349-
350- # Try multiple download URLs
351- if curl -L -o railway "https://github.com/railwayapp/cli/releases/download/${RAILWAY_VERSION}/railway-linux-amd64"; then
352- echo "✅ Download successful"
353- elif curl -L -o railway "https://github.com/railwayapp/cli/releases/download/${RAILWAY_VERSION}/railway_linux_amd64"; then
354- echo "✅ Download successful (alternative URL)"
355- else
356- echo "❌ All download methods failed"
357- exit 1
358- fi
359-
360- # Verify the downloaded file
361- if [ ! -f "railway" ]; then
362- echo "❌ Downloaded file not found"
363- exit 1
364- fi
365-
366- # Check if file is a valid binary (not HTML error page)
367- if head -n 1 railway | grep -q "Not Found\|404\|HTML"; then
368- echo "❌ Downloaded file appears to be an error page, not a binary"
369- cat railway
370- exit 1
371- fi
346+ echo "🚀 Starting Vercel deployment process..."
372347
373- # Make executable and move to PATH
374- chmod +x railway
375- sudo mv railway /usr/local/bin/railway
376- }
348+ # Install Vercel CLI
349+ echo "📦 Installing Vercel CLI..."
350+ npm install -g vercel
377351
378352 # Verify installation
379- echo "🔍 Verifying Railway CLI installation..."
380- if ! command -v railway &> /dev/null; then
381- echo "❌ Railway CLI not found in PATH"
382- which railway || echo "railway command not found"
383- exit 1
384- fi
385-
386- echo "✅ Railway CLI installed successfully"
387- railway --version || railway version
353+ echo "🔍 Verifying Vercel CLI installation..."
354+ vercel --version
388355
389- # Authenticate with Railway
390- echo "🔐 Authenticating with Railway ..."
391- if [ -z "$RAILWAY_TOKEN " ]; then
392- echo "❌ RAILWAY_TOKEN environment variable is not set"
356+ # Authenticate with Vercel
357+ echo "🔐 Authenticating with Vercel ..."
358+ if [ -z "$VERCEL_TOKEN " ]; then
359+ echo "❌ VERCEL_TOKEN environment variable is not set"
393360 exit 1
394361 fi
395362
396363 # Login with token
397- if ! railway login --token "$RAILWAY_TOKEN "; then
398- echo "❌ Railway authentication failed"
364+ if ! vercel login --token "$VERCEL_TOKEN "; then
365+ echo "❌ Vercel authentication failed"
399366 exit 1
400367 fi
401368
402- echo "✅ Successfully authenticated with Railway "
369+ echo "✅ Successfully authenticated with Vercel "
403370
404- # Deploy to Railway
405- echo "🚀 Deploying application to Railway..."
406- if ! railway up --detach; then
407- echo "❌ Railway deployment failed"
408- railway status || echo "Could not get deployment status"
371+ # Link to project (if needed)
372+ echo "🔗 Linking to Vercel project..."
373+ if [ -n "$VERCEL_ORG_ID" ] && [ -n "$VERCEL_PROJECT_ID" ]; then
374+ vercel link --project "$VERCEL_PROJECT_ID" --org "$VERCEL_ORG_ID" --yes || true
375+ fi
376+
377+ # Deploy to Vercel
378+ echo "🚀 Deploying application to Vercel..."
379+ if ! vercel --prod --yes; then
380+ echo "❌ Vercel deployment failed"
409381 exit 1
410382 fi
411383
412- echo "✅ Railway deployment initiated successfully!"
384+ echo "✅ Vercel deployment initiated successfully!"
413385
414386 # Get deployment URL
415387 echo "🔗 Getting deployment URL..."
416388 sleep 10
417- railway status || echo "Could not get deployment status"
389+ DEPLOYMENT_URL=$(vercel ls | grep "https://" | head -n 1 | awk '{print $2}')
390+ if [ -n "$DEPLOYMENT_URL" ]; then
391+ echo "url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
392+ echo "✅ Deployment URL: $DEPLOYMENT_URL"
393+ else
394+ echo "⚠️ Could not retrieve deployment URL"
395+ fi
418396
419397 - name : 🏥 Post-Deployment Health Check
420398 run : |
421399 echo "⏳ Waiting for deployment to stabilize..."
422400 sleep 60
423401
424- echo "🔍 Checking Railway deployment status..."
425- railway status || echo "⚠️ Could not retrieve deployment status"
402+ # Try to get the deployment URL from Vercel
403+ DEPLOYMENT_URL=$(vercel ls 2>/dev/null | grep "https://" | head -n 1 | awk '{print $2}' || echo "")
404+
405+ if [ -n "$DEPLOYMENT_URL" ]; then
406+ echo "🔍 Checking Vercel deployment health at: $DEPLOYMENT_URL"
407+
408+ # Health check
409+ if curl -f -s "$DEPLOYMENT_URL/api/health" > /dev/null 2>&1; then
410+ echo "✅ Health check passed!"
411+ else
412+ echo "⚠️ Health check failed, but deployment may still be initializing"
413+ fi
414+
415+ # Check main application
416+ if curl -f -s "$DEPLOYMENT_URL/" > /dev/null 2>&1; then
417+ echo "✅ Main application accessible"
418+ else
419+ echo "⚠️ Main application not yet accessible"
420+ fi
421+ else
422+ echo "⚠️ Could not determine deployment URL for health checks"
423+ fi
426424
427- echo "✅ Railway deployment process completed!"
425+ echo "✅ Vercel deployment process completed!"
428426
429427 - name : 📢 Deployment Notification
430428 if : always()
@@ -442,7 +440,7 @@ jobs:
442440 post-deployment-monitoring :
443441 name : 📊 Post-Deployment Monitoring
444442 runs-on : ubuntu-latest
445- needs : [railway -deployment]
443+ needs : [vercel -deployment]
446444 if : github.ref == 'refs/heads/main' && github.event_name == 'push'
447445
448446 steps :
@@ -489,7 +487,7 @@ jobs:
489487 echo " ✅ Docker Security & Build Validation"
490488 echo " ✅ Frontend Asset Optimization"
491489 echo " ✅ Pre-Deployment Validation"
492- echo " ✅ Railway Production Deployment"
490+ echo " ✅ Vercel Production Deployment"
493491 echo " ✅ Post-Deployment Monitoring"
494492 echo ""
495493 echo "🚀 Banking application successfully deployed to Railway!"
0 commit comments