Skip to content

Commit b988c55

Browse files
committed
feat: enhance versions.html and deploy-site.yml for improved version display and navigation
1 parent 10c1ee9 commit b988c55

2 files changed

Lines changed: 99 additions & 16 deletions

File tree

.github/templates/versions.html

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!DOCTYPE html>
2-
<html>
2+
<html lang="en">
33
<head>
4+
<meta charset="UTF-8">
45
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
56
<meta http-equiv="Pragma" content="no-cache">
67
<meta http-equiv="Expires" content="0">
@@ -135,6 +136,32 @@
135136
.github-link svg {
136137
fill: white;
137138
}
139+
.maven-link {
140+
display: inline-flex;
141+
align-items: center;
142+
gap: 8px;
143+
background: #6f42c1;
144+
color: white;
145+
padding: 12px 24px;
146+
border-radius: 6px;
147+
text-decoration: none;
148+
font-weight: 600;
149+
margin-top: 15px;
150+
transition: background 0.2s;
151+
}
152+
.maven-link:hover {
153+
background: #5a32a3;
154+
text-decoration: none;
155+
}
156+
.maven-link svg {
157+
fill: white;
158+
}
159+
.header-buttons {
160+
display: flex;
161+
gap: 12px;
162+
justify-content: center;
163+
flex-wrap: wrap;
164+
}
138165
.legend {
139166
display: flex;
140167
flex-wrap: wrap;
@@ -167,16 +194,58 @@
167194
.legend-color.archived {
168195
background: #6c757d;
169196
}
197+
.collapsible {
198+
margin-top: 30px;
199+
}
200+
.collapsible-toggle {
201+
background: #f6f8fa;
202+
border: 1px solid #e1e4e8;
203+
border-radius: 6px;
204+
padding: 12px 20px;
205+
cursor: pointer;
206+
display: flex;
207+
align-items: center;
208+
justify-content: space-between;
209+
width: 100%;
210+
font-size: 16px;
211+
font-weight: 500;
212+
color: #24292e;
213+
transition: background 0.2s;
214+
}
215+
.collapsible-toggle:hover {
216+
background: #ebeef1;
217+
}
218+
.collapsible-toggle::after {
219+
content: '▶';
220+
font-size: 12px;
221+
transition: transform 0.2s;
222+
}
223+
.collapsible-toggle.open::after {
224+
transform: rotate(90deg);
225+
}
226+
.collapsible-content {
227+
display: none;
228+
padding-top: 10px;
229+
}
230+
.collapsible-content.open {
231+
display: block;
232+
}
170233
</style>
171234
</head>
172235
<body>
173236
<div class="container">
174237
<div class="header">
175-
<h1>📚 Copilot SDK for Java</h1>
176-
<a href="https://github.com/copilot-community-sdk/copilot-sdk-java" class="github-link">
177-
<svg height="20" width="20" viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
178-
View on GitHub
179-
</a>
238+
<h1>Copilot SDK for Java</h1>
239+
<div class="header-buttons">
240+
<a href="https://github.com/copilot-community-sdk/copilot-sdk-java" class="github-link">
241+
<svg height="20" width="20" viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
242+
View on GitHub
243+
</a>
244+
<a href="https://central.sonatype.com/artifact/io.github.copilot-community-sdk/copilot-sdk" class="maven-link">
245+
<svg height="20" width="20" viewBox="0 0 24 24"><path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path></svg>
246+
View on Maven Central
247+
</a>
248+
</div>
180249
</div>
181250

182251
<div class="warning">
@@ -189,9 +258,20 @@ <h1>📚 Copilot SDK for Java</h1>
189258

190259
<h2>Available Versions</h2>
191260
<ul class="version-list">
192-
<!-- VERSION_LIST_PLACEHOLDER -->
261+
<!-- CURRENT_VERSIONS_PLACEHOLDER -->
193262
</ul>
194263

264+
<div class="collapsible">
265+
<button class="collapsible-toggle" onclick="this.classList.toggle('open'); this.nextElementSibling.classList.toggle('open');">
266+
Older Releases
267+
</button>
268+
<div class="collapsible-content">
269+
<ul class="version-list">
270+
<!-- OLDER_VERSIONS_PLACEHOLDER -->
271+
</ul>
272+
</div>
273+
</div>
274+
195275
<div class="legend">
196276
<div class="legend-item">
197277
<div class="legend-color latest"></div>
@@ -206,7 +286,8 @@ <h2>Available Versions</h2>
206286
<div class="footer">
207287
<p>
208288
<a href="https://github.com/copilot-community-sdk/copilot-sdk-java">GitHub Repository</a> ·
209-
<a href="https://central.sonatype.com/artifact/io.github.copilot-community-sdk/copilot-sdk">Maven Central</a>
289+
<a href="https://central.sonatype.com/artifact/io.github.copilot-community-sdk/copilot-sdk">Maven Central</a> ·
290+
<a href="https://github.com/copilot-community-sdk/copilot-sdk-java/blob/main/LICENSE">MIT License</a>
210291
</p>
211292
</div>
212293
</div>

.github/workflows/deploy-site.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,28 +191,30 @@ jobs:
191191
HAS_SNAPSHOT=$([ -d "snapshot" ] && echo "true" || echo "false")
192192
193193
# Generate version links
194-
VERSION_HTML=""
194+
CURRENT_HTML=""
195+
OLDER_HTML=""
195196
IS_FIRST_VERSION="true"
196197
197-
# Add snapshot if exists
198+
# Add snapshot if exists (goes to current versions)
198199
if [ "$HAS_SNAPSHOT" = "true" ]; then
199-
VERSION_HTML+='<li><a href="./snapshot/">Development (main branch)</a><span class="badge snapshot">snapshot</span></li>'
200+
CURRENT_HTML+='<li><a href="./snapshot/">Development (main branch)</a><span class="badge snapshot">snapshot</span></li>'
200201
fi
201202
202-
# Add versioned releases from tags (first one is latest)
203+
# Add versioned releases from tags (first one is latest, rest go to older)
203204
for v in $VERSIONS; do
204205
if [ -d "$v" ]; then
205206
if [ "$IS_FIRST_VERSION" = "true" ]; then
206-
VERSION_HTML+="<li class=\"latest-version\"><a href=\"./$v/\">Version $v</a><span class=\"badge latest\">latest</span></li>"
207+
CURRENT_HTML+="<li class=\"latest-version\"><a href=\"./$v/\">Version $v</a><span class=\"badge latest\">latest</span></li>"
207208
IS_FIRST_VERSION="false"
208209
else
209-
VERSION_HTML+="<li><a href=\"./$v/\">Version $v</a></li>"
210+
OLDER_HTML+="<li><a href=\"./$v/\">Version $v</a></li>"
210211
fi
211212
fi
212213
done
213214
214-
# Update the index.html using the placeholder
215-
sed -i "s|<!-- VERSION_LIST_PLACEHOLDER -->|$VERSION_HTML|" index.html
215+
# Update the index.html using the placeholders
216+
sed -i "s|<!-- CURRENT_VERSIONS_PLACEHOLDER -->|$CURRENT_HTML|" index.html
217+
sed -i "s|<!-- OLDER_VERSIONS_PLACEHOLDER -->|$OLDER_HTML|" index.html
216218
217219
- name: Deploy to GitHub Pages
218220
run: |

0 commit comments

Comments
 (0)