-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-to-github.sh
More file actions
60 lines (51 loc) · 1.63 KB
/
deploy-to-github.sh
File metadata and controls
60 lines (51 loc) · 1.63 KB
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
52
53
54
55
56
57
58
59
60
#!/bin/bash
# GitHub + Vercel Deployment Script
# This script helps you deploy your Node.js API to GitHub and prepare for Vercel
echo "🚀 Starting deployment process..."
# Check if git is initialized
if [ ! -d ".git" ]; then
echo "📁 Initializing Git repository..."
git init
fi
# Check if .env file exists
if [ ! -f ".env" ]; then
echo "⚠️ .env file not found!"
echo "📝 Creating .env file from template..."
cp env.example .env
echo "✅ .env file created. Please update it with your actual values."
echo " Edit the .env file and then run this script again."
exit 1
fi
# Add all files
echo "📦 Adding files to Git..."
git add .
# Check if there are changes to commit
if git diff --cached --quiet; then
echo "ℹ️ No changes to commit."
else
echo "💾 Committing changes..."
git commit -m "Deploy to GitHub and Vercel - $(date)"
fi
# Check if remote origin exists
if ! git remote get-url origin > /dev/null 2>&1; then
echo "🔗 Please add your GitHub repository as remote origin:"
echo " git remote add origin https://github.com/YOUR_USERNAME/hospient-api.git"
echo ""
echo " Then run this script again."
exit 1
fi
# Push to GitHub
echo "📤 Pushing to GitHub..."
git push origin main
echo ""
echo "✅ GitHub deployment completed!"
echo ""
echo "📋 Next steps:"
echo "1. Go to https://vercel.com"
echo "2. Sign up/Login with your GitHub account"
echo "3. Click 'New Project'"
echo "4. Import your GitHub repository"
echo "5. Configure environment variables in Vercel dashboard"
echo "6. Deploy!"
echo ""
echo "📖 See VERCEL_DEPLOYMENT.md for detailed instructions."