ai-api-testing / deploy.sh
Amit Kasar
test
2590fc1
Raw History Blame Contribute Delete
1.47 kB
#!/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."