-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-to-github.sh
More file actions
executable file
Β·170 lines (147 loc) Β· 5.2 KB
/
deploy-to-github.sh
File metadata and controls
executable file
Β·170 lines (147 loc) Β· 5.2 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/bash
# ZENTAXA Landing Page - GitHub Deployment Script
# This script automates the process of pushing your code to GitHub
set -e # Exit on error
echo "π ZENTAXA Landing Page - GitHub Deployment"
echo "==========================================="
echo ""
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Check if we're in the correct directory
if [ ! -f "index.html" ]; then
echo -e "${RED}β Error: index.html not found!${NC}"
echo "Please run this script from the front-end directory."
exit 1
fi
echo -e "${BLUE}π Current directory: $(pwd)${NC}"
echo ""
# Check if git is installed
if ! command -v git &> /dev/null; then
echo -e "${RED}β Error: Git is not installed!${NC}"
echo "Please install git first: sudo apt-get install git"
exit 1
fi
echo -e "${GREEN}β
Git is installed${NC}"
# Check if already initialized
if [ ! -d ".git" ]; then
echo -e "${YELLOW}π§ Initializing Git repository...${NC}"
git init
echo -e "${GREEN}β
Git initialized${NC}"
else
echo -e "${GREEN}β
Git repository already initialized${NC}"
fi
# Get GitHub username
echo ""
echo -e "${BLUE}Please enter your GitHub username:${NC}"
read -p "Username: " GITHUB_USERNAME
if [ -z "$GITHUB_USERNAME" ]; then
echo -e "${RED}β Error: GitHub username cannot be empty!${NC}"
exit 1
fi
# Get repository name
echo ""
echo -e "${BLUE}Please enter repository name (default: zentaxa-landing-page):${NC}"
read -p "Repository name: " REPO_NAME
REPO_NAME=${REPO_NAME:-zentaxa-landing-page}
echo ""
echo -e "${YELLOW}π Repository will be: https://github.com/$GITHUB_USERNAME/$REPO_NAME${NC}"
echo ""
read -p "Is this correct? (y/n): " CONFIRM
if [ "$CONFIRM" != "y" ] && [ "$CONFIRM" != "Y" ]; then
echo -e "${RED}β Cancelled by user${NC}"
exit 1
fi
# Configure git (if not already configured)
if [ -z "$(git config --global user.email)" ]; then
echo ""
echo -e "${YELLOW}π§ Configuring Git...${NC}"
read -p "Enter your email: " GIT_EMAIL
read -p "Enter your name: " GIT_NAME
git config --global user.email "$GIT_EMAIL"
git config --global user.name "$GIT_NAME"
echo -e "${GREEN}β
Git configured${NC}"
fi
# Add all files
echo ""
echo -e "${YELLOW}π¦ Adding files to Git...${NC}"
git add .
# Check if there are changes to commit
if git diff --staged --quiet; then
echo -e "${YELLOW}β οΈ No changes to commit${NC}"
else
# Commit changes
echo ""
echo -e "${BLUE}Enter commit message (default: 'Initial commit: ZENTAXA landing page'):${NC}"
read -p "Commit message: " COMMIT_MSG
COMMIT_MSG=${COMMIT_MSG:-"Initial commit: ZENTAXA landing page"}
git commit -m "$COMMIT_MSG"
echo -e "${GREEN}β
Changes committed${NC}"
fi
# Check if remote already exists
if git remote | grep -q "^origin$"; then
echo -e "${YELLOW}β οΈ Remote 'origin' already exists. Removing...${NC}"
git remote remove origin
fi
# Add remote
echo ""
echo -e "${YELLOW}π Adding GitHub remote...${NC}"
git remote add origin "https://github.com/$GITHUB_USERNAME/$REPO_NAME.git"
echo -e "${GREEN}β
Remote added${NC}"
# Rename branch to main
echo ""
echo -e "${YELLOW}πΏ Ensuring branch is named 'main'...${NC}"
git branch -M main
echo -e "${GREEN}β
Branch set to 'main'${NC}"
# Push to GitHub
echo ""
echo -e "${YELLOW}π Pushing to GitHub...${NC}"
echo -e "${BLUE}You may be prompted for your GitHub credentials.${NC}"
echo ""
if git push -u origin main; then
echo ""
echo -e "${GREEN}================================================${NC}"
echo -e "${GREEN}β
SUCCESS! Code pushed to GitHub!${NC}"
echo -e "${GREEN}================================================${NC}"
echo ""
echo -e "${BLUE}π Repository URL:${NC}"
echo " https://github.com/$GITHUB_USERNAME/$REPO_NAME"
echo ""
echo -e "${BLUE}π To enable GitHub Pages:${NC}"
echo " 1. Go to: https://github.com/$GITHUB_USERNAME/$REPO_NAME/settings/pages"
echo " 2. Under 'Build and deployment' β Source: Select 'GitHub Actions'"
echo " 3. Save changes"
echo ""
echo -e "${BLUE}πΊ Your site will be live at:${NC}"
echo " https://$GITHUB_USERNAME.github.io/$REPO_NAME/"
echo ""
echo -e "${GREEN}π Deployment complete!${NC}"
echo ""
else
echo ""
echo -e "${RED}================================================${NC}"
echo -e "${RED}β Push failed!${NC}"
echo -e "${RED}================================================${NC}"
echo ""
echo -e "${YELLOW}Possible reasons:${NC}"
echo "1. Repository doesn't exist on GitHub"
echo " β Create it at: https://github.com/new"
echo "2. Authentication failed"
echo " β Use personal access token instead of password"
echo "3. No permission to push"
echo " β Check repository permissions"
echo ""
echo -e "${BLUE}To create repository:${NC}"
echo "1. Go to: https://github.com/new"
echo "2. Name: $REPO_NAME"
echo "3. Description: ZENTAXA AI Agent Management Platform - Landing Page"
echo "4. Choose Public or Private"
echo "5. Do NOT initialize with README"
echo "6. Click 'Create repository'"
echo ""
echo "Then run this script again!"
exit 1
fi