Repository navigation
Expand file tree
/
Copy pathdeploy-github-pages.sh
More file actions
173 lines (149 loc) Β· 5.21 KB
/
Copy pathdeploy-github-pages.sh
File metadata and controls
173 lines (149 loc) Β· 5.21 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
171
172
173
#!/bin/bash
# Requirements Tracker - GitHub Pages Deployment Script
# Copyright (C) 2024 DRYTRIX
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
set -e
echo "π Requirements Tracker - GitHub Pages Deployment Script"
echo "========================================================"
# Check if we're in the right directory
if [ ! -f "app.py" ] || [ ! -f "index.html" ]; then
echo "β Error: This script must be run from the RequirementsTracker directory"
exit 1
fi
# Check if git is available
if ! command -v git &> /dev/null; then
echo "β Error: Git is not installed or not in PATH"
exit 1
fi
# Check if we're in a git repository
if [ ! -d ".git" ]; then
echo "β Error: This is not a git repository"
exit 1
fi
# Check if we have uncommitted changes
if [ -n "$(git status --porcelain)" ]; then
echo "β οΈ Warning: You have uncommitted changes"
echo " Please commit or stash them before deploying"
read -p " Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "β Deployment cancelled"
exit 1
fi
fi
# Check current branch
CURRENT_BRANCH=$(git branch --show-current)
if [ "$CURRENT_BRANCH" != "main" ]; then
echo "β οΈ Warning: You're not on the main branch (current: $CURRENT_BRANCH)"
read -p " Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "β Deployment cancelled"
exit 1
fi
fi
echo "π Checking repository status..."
echo " Current branch: $CURRENT_BRANCH"
echo " Remote: $(git remote get-url origin)"
# Check if remote is accessible
if ! git ls-remote --exit-code origin &> /dev/null; then
echo "β Error: Cannot access remote repository"
echo " Please check your internet connection and repository URL"
exit 1
fi
echo "β
Repository status OK"
# Check if required files exist
echo "π Checking required files..."
REQUIRED_FILES=("index.html" "LICENSE" "README.md" ".nojekyll" ".github/workflows/deploy.yml")
MISSING_FILES=()
for file in "${REQUIRED_FILES[@]}"; do
if [ ! -f "$file" ]; then
MISSING_FILES+=("$file")
fi
done
if [ ${#MISSING_FILES[@]} -ne 0 ]; then
echo "β Error: Missing required files:"
for file in "${MISSING_FILES[@]}"; do
echo " - $file"
done
exit 1
fi
echo "β
All required files present"
# Check if screenshots exist
echo "πΌοΈ Checking screenshots..."
SCREENSHOT_DIR="assets/screenshots"
REQUIRED_SCREENSHOTS=("dashboard.png" "projects.png" "New Requirement.png" "Analytics.png" "admin.png")
MISSING_SCREENSHOTS=()
if [ ! -d "$SCREENSHOT_DIR" ]; then
echo "β Error: Screenshots directory not found: $SCREENSHOT_DIR"
exit 1
fi
for screenshot in "${REQUIRED_SCREENSHOTS[@]}"; do
if [ ! -f "$SCREENSHOT_DIR/$screenshot" ]; then
MISSING_SCREENSHOTS+=("$screenshot")
fi
done
if [ ${#MISSING_SCREENSHOTS[@]} -ne 0 ]; then
echo "β οΈ Warning: Missing screenshots:"
for screenshot in "${MISSING_SCREENSHOTS[@]}"; do
echo " - $screenshot"
done
read -p " Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "β Deployment cancelled"
exit 1
fi
else
echo "β
All screenshots present"
fi
# Add all changes
echo "π Adding changes to git..."
git add .
# Check if there are changes to commit
if [ -z "$(git status --porcelain)" ]; then
echo "βΉοΈ No changes to commit"
else
echo "πΎ Committing changes..."
git commit -m "Add GPL 3 license, update README with screenshots, and create GitHub Pages site
- Add GNU General Public License v3.0
- Update README.md with screenshots and improved documentation
- Create static GitHub Pages site (index.html)
- Add GitHub Actions workflow for automatic deployment
- Add .nojekyll file for custom static site
- Update license headers in main application files
- Create deployment documentation and scripts"
fi
# Push to GitHub
echo "π Pushing to GitHub..."
git push origin main
echo ""
echo "β
Deployment initiated successfully!"
echo ""
echo "π Next steps:"
echo " 1. Go to your repository on GitHub: https://github.com/DRYTRIX/RequirementsTracker"
echo " 2. Click on 'Settings' tab"
echo " 3. Scroll down to 'Pages' section"
echo " 4. Under 'Source', select 'Deploy from a branch'"
echo " 5. Choose 'gh-pages' branch"
echo " 6. Click 'Save'"
echo ""
echo " 7. Go to 'Actions' tab to monitor deployment progress"
echo " 8. Once complete, your site will be available at:"
echo " https://drytrix.github.io/RequirementsTracker/"
echo ""
echo "π For more information, see: setup-github-pages.md"
echo ""
echo "π Happy coding!"