File size: 1,474 Bytes
2590fc1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/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."