-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepare-deploy.sh
More file actions
executable file
·68 lines (56 loc) · 1.77 KB
/
prepare-deploy.sh
File metadata and controls
executable file
·68 lines (56 loc) · 1.77 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
#!/bin/bash
# Prepare repository for GitHub Pages deployment
# This script copies actual files instead of using symlinks
set -e
echo "🚀 Preparing CodeWiki Demo for Deployment"
echo "=========================================="
echo ""
# Configuration
SOURCE_DOCS="/home/anhnh/CodeWiki/output/docs"
TARGET_DOCS="./docs"
# Check if source exists
if [ ! -d "$SOURCE_DOCS" ]; then
echo "❌ Error: Source docs directory not found at $SOURCE_DOCS"
exit 1
fi
# Remove existing docs (symlink or directory)
if [ -L "$TARGET_DOCS" ]; then
echo "📝 Removing existing symlink..."
rm "$TARGET_DOCS"
elif [ -d "$TARGET_DOCS" ]; then
echo "📝 Removing existing docs directory..."
rm -rf "$TARGET_DOCS"
fi
# Copy documentation
echo "📦 Copying documentation from $SOURCE_DOCS..."
cp -r "$SOURCE_DOCS" "$TARGET_DOCS"
# Check if copy was successful
if [ ! -d "$TARGET_DOCS" ]; then
echo "❌ Error: Failed to copy documentation"
exit 1
fi
# Count projects
PROJECT_COUNT=$(find "$TARGET_DOCS" -maxdepth 1 -type d | wc -l)
PROJECT_COUNT=$((PROJECT_COUNT - 1)) # Subtract 1 for the docs folder itself
echo "✅ Copied $PROJECT_COUNT project(s)"
echo ""
# Generate projects.json
echo "🔄 Generating projects.json..."
node generate-projects.js
if [ ! -f "projects.json" ]; then
echo "❌ Error: Failed to generate projects.json"
exit 1
fi
echo ""
echo "=========================================="
echo "✨ Preparation complete!"
echo ""
echo "Next steps:"
echo " 1. Review changes: git status"
echo " 2. Commit: git add . && git commit -m 'Prepare for deployment'"
echo " 3. Push: git push origin main"
echo " 4. Enable GitHub Pages in repository settings"
echo ""
echo "Your site will be available at:"
echo " https://fsoft-ai4code.github.io/codewiki-demo/"
echo ""