-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·69 lines (59 loc) · 1.67 KB
/
deploy.sh
File metadata and controls
executable file
·69 lines (59 loc) · 1.67 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
61
62
63
64
65
66
67
68
69
#!/bin/bash
echo "🚀 CodeVisualizer - GitHub Pages Deployment Script"
echo "=================================================="
echo ""
# Check if git remote exists
if ! git remote get-url origin > /dev/null 2>&1; then
echo "⚠️ No GitHub remote found!"
echo ""
echo "Please follow these steps first:"
echo "1. Create a new repository on GitHub: https://github.com/new"
echo "2. Name it: CodeVisualizer"
echo "3. Run this command (replace YOUR_USERNAME):"
echo ""
echo " git remote add origin https://github.com/YOUR_USERNAME/CodeVisualizer.git"
echo ""
echo "4. Update 'homepage' in package.json with your GitHub username"
echo ""
exit 1
fi
echo "✅ Git remote found!"
echo ""
# Get the remote URL
REMOTE_URL=$(git remote get-url origin)
echo "📍 Remote: $REMOTE_URL"
echo ""
# Ask for confirmation
echo "Ready to deploy? This will:"
echo " 1. Build the production version"
echo " 2. Deploy to GitHub Pages"
echo ""
read -p "Continue? (y/n) " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "❌ Deployment cancelled"
exit 1
fi
echo ""
echo "🏗️ Building and deploying..."
echo ""
# Deploy
npm run deploy
if [ $? -eq 0 ]; then
echo ""
echo "✅ Deployment successful!"
echo ""
echo "Your app will be live in 2-5 minutes at:"
# Extract username and repo from git remote
if [[ $REMOTE_URL =~ github\.com[:/]([^/]+)/([^/.]+) ]]; then
USERNAME="${BASH_REMATCH[1]}"
REPO="${BASH_REMATCH[2]}"
echo " https://$USERNAME.github.io/$REPO/"
fi
echo ""
else
echo ""
echo "❌ Deployment failed!"
echo "Check the errors above and try again."
exit 1
fi