Skip to content

Commit e0e790b

Browse files
committed
Update docs workflow to ensure versioning and add version index page 🙃
1 parent 1c440b8 commit e0e790b

1 file changed

Lines changed: 97 additions & 2 deletions

File tree

.github/workflows/docs.yml

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
paths:
77
- 'docs/**'
88
- 'mkdocs.yml'
9+
- '.github/workflows/docs.yml'
910
workflow_dispatch:
1011

1112
permissions:
@@ -49,6 +50,100 @@ jobs:
4950
rm -rf develop/
5051
cp -r site/ develop/
5152
53+
# Ensure v1 docs exist (copy from master if missing)
54+
if [ ! -d "v1" ]; then
55+
git checkout origin/master -- docs/ 2>/dev/null || true
56+
if [ -d "docs" ]; then
57+
mv docs v1
58+
fi
59+
fi
60+
61+
# Generate version index page
62+
cat > index.html << 'INDEXEOF'
63+
<!DOCTYPE html>
64+
<html lang="en">
65+
<head>
66+
<meta charset="utf-8">
67+
<meta name="viewport" content="width=device-width, initial-scale=1">
68+
<title>phpGPX Documentation</title>
69+
<style>
70+
* { margin: 0; padding: 0; box-sizing: border-box; }
71+
body {
72+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
73+
background: #fafafa;
74+
color: #333;
75+
min-height: 100vh;
76+
display: flex;
77+
flex-direction: column;
78+
align-items: center;
79+
justify-content: center;
80+
}
81+
.container { max-width: 600px; padding: 2rem; text-align: center; }
82+
h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
83+
.tagline { color: #666; margin-bottom: 2.5rem; font-size: 1.1rem; }
84+
.versions { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
85+
.version-card {
86+
display: block;
87+
padding: 2rem 2.5rem;
88+
border-radius: 12px;
89+
text-decoration: none;
90+
color: #333;
91+
background: #fff;
92+
border: 2px solid #e0e0e0;
93+
transition: all 0.2s ease;
94+
min-width: 200px;
95+
}
96+
.version-card:hover {
97+
border-color: #009688;
98+
box-shadow: 0 4px 12px rgba(0,150,136,0.15);
99+
transform: translateY(-2px);
100+
}
101+
.version-card .ver { font-size: 1.5rem; font-weight: 700; }
102+
.version-card .badge {
103+
display: inline-block;
104+
padding: 0.15rem 0.5rem;
105+
border-radius: 4px;
106+
font-size: 0.75rem;
107+
font-weight: 600;
108+
margin-left: 0.4rem;
109+
vertical-align: middle;
110+
}
111+
.badge-stable { background: #e8f5e9; color: #2e7d32; }
112+
.badge-dev { background: #fff3e0; color: #e65100; }
113+
.version-card .desc { color: #888; font-size: 0.9rem; margin-top: 0.5rem; }
114+
.github {
115+
margin-top: 2.5rem;
116+
color: #999;
117+
font-size: 0.85rem;
118+
}
119+
.github a { color: #009688; text-decoration: none; }
120+
.github a:hover { text-decoration: underline; }
121+
</style>
122+
</head>
123+
<body>
124+
<div class="container">
125+
<h1>phpGPX</h1>
126+
<p class="tagline">A PHP library for reading, creating, and manipulating GPX files</p>
127+
<div class="versions">
128+
<a href="v1/" class="version-card">
129+
<div class="ver">1.x <span class="badge badge-stable">stable</span></div>
130+
<div class="desc">Current release</div>
131+
</a>
132+
<a href="develop/" class="version-card">
133+
<div class="ver">2.x <span class="badge badge-dev">develop</span></div>
134+
<div class="desc">Next major version</div>
135+
</a>
136+
</div>
137+
<p class="github">
138+
<a href="https://github.com/Sibyx/phpGPX">GitHub</a> &middot;
139+
<a href="https://packagist.org/packages/sibyx/phpgpx">Packagist</a>
140+
</p>
141+
</div>
142+
</body>
143+
</html>
144+
INDEXEOF
145+
52146
# Commit and push
53-
git add develop/
54-
git diff --cached --quiet || (git commit -m "Deploy docs (develop) from ${GITHUB_SHA::8}" && git push origin gh-pages)
147+
git add develop/ index.html
148+
[ -d "v1" ] && git add v1/
149+
git diff --cached --quiet || (git commit -m "Deploy docs from ${GITHUB_SHA::8}" && git push origin gh-pages)

0 commit comments

Comments
 (0)