#!/bin/bash # Exit immediately if a command exits with a non-zero status set -e echo "🚀 Starting Full Deployment Process..." echo "" # ========================================== # 1. Deploy Backend to Hugging Face # ========================================== echo "📦 [1/2] Deploying Backend to Hugging Face Spaces..." cd "$(dirname "$0")" # Check if there are changes to commit if [[ -n $(git status -s) ]]; then git add . # Prompt for an optional commit message read -p "Enter commit message (or press enter for default 'Auto-deployment update'): " commit_msg commit_msg=${commit_msg:-"Auto-deployment update"} git commit -m "$commit_msg" echo "Pushing to Hugging Face... (You may be prompted for your Username and Access Token)" git push echo "✅ Backend successfully pushed to Hugging Face!" else echo "⚡ No backend changes detected. Skipping git push." fi echo "" # ========================================== # 2. Deploy Frontend to Vercel # ========================================== echo "🌐 [2/2] Deploying Frontend to Vercel..." cd frontend-react # Check if Vercel CLI is installed if ! command -v vercel &> /dev/null; then echo "❌ Vercel CLI could not be found. Please install it first with:" echo " sudo npm install -g vercel" exit 1 fi # Deploy to production echo "Running Vercel production deployment..." vercel --prod echo "" echo "🎉 All Done! Your project is fully deployed."