-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
94 lines (81 loc) · 2.49 KB
/
Copy pathdeploy.sh
File metadata and controls
94 lines (81 loc) · 2.49 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
# Abrol Lab Website - GitHub Pages Deployment Script
# This script helps deploy your website to GitHub Pages
echo "🚀 Abrol Lab Website - GitHub Pages Deployment"
echo "=============================================="
echo ""
# Check if git is initialized
if [ ! -d .git ]; then
echo "❌ Error: Not a git repository. Run 'git init' first."
exit 1
fi
# Check for uncommitted changes
if [[ -n $(git status -s) ]]; then
echo "📝 Found uncommitted changes. Creating commit..."
git add .
# Ask for commit message
echo ""
echo "Enter commit message (or press Enter for default):"
read commit_message
if [ -z "$commit_message" ]; then
commit_message="Update Abrol Lab website"
fi
git commit -m "$commit_message"
echo "✅ Changes committed"
else
echo "✅ No uncommitted changes"
fi
# Check if remote exists
if ! git remote | grep -q origin; then
echo ""
echo "⚠️ No remote repository configured."
echo "Please enter your GitHub repository URL:"
echo "Example: git@github.com:username/repository.git"
read repo_url
if [ -n "$repo_url" ]; then
git remote add origin "$repo_url"
echo "✅ Remote repository added"
else
echo "❌ No repository URL provided. Exiting."
exit 1
fi
fi
# Check current branch
current_branch=$(git branch --show-current)
if [ -z "$current_branch" ]; then
echo ""
echo "📌 Creating main branch..."
git branch -M main
current_branch="main"
fi
# Push to GitHub
echo ""
echo "🚀 Pushing to GitHub..."
git push -u origin "$current_branch"
if [ $? -eq 0 ]; then
echo ""
echo "=============================================="
echo "✅ Successfully deployed to GitHub!"
echo "=============================================="
echo ""
echo "📍 Next Steps:"
echo "1. Go to your GitHub repository"
echo "2. Click Settings → Pages"
echo "3. Set Source to: main branch, / (root) folder"
echo "4. Click Save"
echo "5. Wait 2-3 minutes"
echo "6. Your site will be live!"
echo ""
echo "🌐 Your site URL will be:"
echo " https://USERNAME.github.io/REPO-NAME/"
echo ""
else
echo ""
echo "❌ Deployment failed. Please check the error above."
echo ""
echo "Common issues:"
echo "- Make sure you have push access to the repository"
echo "- Verify your SSH key is configured on GitHub"
echo "- Check your remote URL is correct: git remote -v"
exit 1
fi