-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·66 lines (57 loc) · 2.1 KB
/
deploy.sh
File metadata and controls
executable file
·66 lines (57 loc) · 2.1 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
#!/bin/bash
set -e # Exit on any error
echo ""
echo "=== Deploying to ./docs directory ==="
echo ""
# Get git commit hash for cache busting
GIT_COMMIT=$(git rev-parse HEAD)
echo "Git commit: $GIT_COMMIT"
# Run Jekyll to build site
echo "Running Jekyll build..."
jekyll build
# Replace $GIT_COMMIT in the BUILT files (in _site), not the source
echo "Replacing \$GIT_COMMIT with actual commit hash in built files..."
find _site -name "*.html" -type f | while read file; do
sed -i.bak "s/\$GIT_COMMIT/$GIT_COMMIT/g" "$file" && rm "$file.bak"
done
# Clean docs directory
echo "Cleaning docs directory..."
rm -rf ./docs/*
mkdir -p ./docs
# Copy only the necessary directories/files from _site to docs
echo "Copying built site to docs..."
# Add .nojekyll to prevent GitHub Pages from running Jekyll processing
touch ./docs/.nojekyll
cp -r _site/cslEditorLib ./docs/
# Copy directories excluded from Jekyll (too many files for Jekyll to process)
echo "Copying style/locale data (excluded from Jekyll for speed)..."
mkdir -p ./docs/cslEditorLib/external
cp -r cslEditorLib/external/csl-styles ./docs/cslEditorLib/external/
cp -r cslEditorLib/external/locales ./docs/cslEditorLib/external/
cp -r cslEditorLib/external/csl-schema ./docs/cslEditorLib/external/
cp -r cslEditorLib/external/jstree ./docs/cslEditorLib/external/
cp -r _site/about ./docs/
cp -r _site/codeEditor ./docs/
cp -r _site/cslDataExporter ./docs/
cp -r _site/external ./docs/
cp -r _site/home ./docs/
cp -r _site/html ./docs/
cp -r _site/images ./docs/
cp -r _site/searchByExample ./docs/
cp -r _site/searchByName ./docs/
cp -r _site/settings ./docs/
cp -r _site/src ./docs/
cp -r _site/styleInfo ./docs/
cp -r _site/visualEditor ./docs/
cp _site/index.html ./docs/
cp _site/CNAME ./docs/ 2>/dev/null || true
cp _site/MIT-LICENCE.txt ./docs/ 2>/dev/null || true
cp _site/*.html ./docs/ 2>/dev/null || true
# Remove node_modules if accidentally copied
rm -rf ./docs/cslEditorLib/node_modules 2>/dev/null
echo ""
echo "=== Build complete! ==="
echo ""
echo "Review changes with: git status"
echo "To commit and push: git add --all && git commit -m 'deploy' && git push"
echo ""