-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathdeploy_docs.sh
More file actions
executable file
·75 lines (62 loc) · 2.05 KB
/
deploy_docs.sh
File metadata and controls
executable file
·75 lines (62 loc) · 2.05 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
#!/bin/bash
set -e
# =============================================================================
# Morphium Documentation Deployment Script
# =============================================================================
# Deploys documentation to gh-pages branch for GitHub Pages hosting.
#
# Usage:
# ./deploy_docs.sh
#
# This script:
# 1. Fetches latest develop branch
# 2. Switches to gh-pages branch
# 3. Copies docs/, README.md, README.de.md from develop
# 4. Creates index.md from README.md for GitHub Pages
# 5. Commits and pushes to gh-pages
# 6. Returns to the original branch
# =============================================================================
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}📚 Deploying documentation to gh-pages...${NC}"
# Remember current branch
original_branch=$(git symbolic-ref --short HEAD 2>/dev/null || echo "")
# Ensure working directory is clean
if ! git diff-index --quiet HEAD --; then
echo "ERROR: Working directory has uncommitted changes"
echo "Please commit or stash your changes before deploying docs"
exit 1
fi
# Ensure we have latest develop
echo "Fetching latest from develop..."
git fetch origin develop
# Switch to gh-pages
echo "Switching to gh-pages branch..."
git checkout gh-pages
git pull origin gh-pages
# Copy docs from develop
echo "Copying documentation from develop..."
git checkout origin/develop -- docs/ README.md README.de.md mkdocs.yml
# Create index.md from README.md for GitHub Pages
cp README.md index.md
# Stage changes
git add docs/ README.md README.de.md mkdocs.yml index.md
# Check if there are changes to commit
if git diff --cached --quiet; then
echo "No documentation changes to deploy"
else
# Commit and push
git commit -m "Update docs: $(date +'%Y-%m-%d %H:%M:%S')"
git push origin gh-pages
echo -e "${GREEN}✅ Documentation deployed!${NC}"
fi
# Return to original branch
if [ -n "$original_branch" ]; then
echo "Returning to $original_branch branch..."
git checkout "$original_branch"
else
git checkout master
fi
echo -e "${GREEN}Done!${NC}"