Skip to content

Commit 8e7d54f

Browse files
committed
Improve index.html
1 parent 0ebe3e4 commit 8e7d54f

4 files changed

Lines changed: 55 additions & 14 deletions

File tree

.github/workflows/scripts/update_gh_pages.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ main() {
9090
"${repo_uri}" \
9191
"${gh_pages_clone_dir}"
9292

93+
# Stop github trying to process the site as jekyll content which means
94+
# it ignores some dirs
95+
touch "${GITHUB_WORKSPACE}/.nojekyll"
96+
9397
# Copy our root index directory page
9498
cp "${GITHUB_WORKSPACE}/index.html" "${gh_pages_clone_dir}/"
9599

ci_build.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ gather_release_artefacts() {
166166
copy_gh_pages_content() {
167167
mkdir -p "${GH_PAGES_DIR}"
168168

169-
# Add a .nojekyll file to stop github assuming the gh-pages content contains
170-
# jekyll templates.
171-
touch "${GH_PAGES_DIR}/.nojekyll"
172-
173169
local javadoc_dir="${BUILD_DIR}/event-logging-api/build/docs/javadoc"
174170
local gh_pages_javadoc_dir="${GH_PAGES_DIR}/javadoc"
175171
mkdir -p "${gh_pages_javadoc_dir}"

index.html

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,53 @@
11
<html>
2+
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>event-logging Versions</title>
7+
<link
8+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css"
9+
rel="stylesheet"
10+
integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor"
11+
crossorigin="anonymous">
12+
</head>
13+
214
<body>
15+
<h1 class="text-center display-2">event-logging Versions</h1>
16+
17+
<div class="container">
18+
<div class="mt-4 text-center">This table lists the latest patch release for each minor version of event-logging.</div>
19+
<table class="table mt-4" id="versions-content" />
20+
</div>
21+
322
<script>
23+
// Build a table of links for the various versions of event-logging
424
(async () => {
25+
const ghPagesBaseUrl = 'https://gchq.github.io/event-logging';
526
const response = await fetch('https://api.github.com/repos/gchq/event-logging/contents/?ref=gh-pages');
627
const data = await response.json();
7-
let htmlString = '<h1>event-logging Documentation</h1>';
8-
htmlString += '<table><tr>';
9-
htmlString += '<th>Version</th>';
28+
let htmlString = '';
29+
htmlString += '<tr>';
30+
htmlString += '<th>Release</th>';
1031
htmlString += '<th>Swagger UI</th>';
1132
htmlString += '<th>Javadoc</th>';
1233
htmlString += '</tr>';
1334

1435
// Add a row for each minor version dir in gh-pages
1536
for (let file of data) {
16-
if (file.type === "dir" && file.name.match("^[0-9]+\.[0-9]+") ) {
37+
if (file.type === "dir" && file.name.match("^v[0-9]+\.[0-9]+") ) {
1738
// Get the actual patch version of this minor version e.g. v1.2.3 for minor version v1.2
18-
let version = await fetch(`https://gchq.github.io/event-logging/${file.name}/version.txt`);
39+
let version_response = await fetch(`${ghPagesBaseUrl}/${file.name}/version.txt`);
40+
let version = await version_response.text();
1941
htmlString += '<tr>';
20-
htmlString += `<td>${version}</td>`;
21-
htmlString += `<td><a href="${file.path}/swagger-ui/">Link</a></td>`;
22-
htmlString += `<td><a href="${file.path}/javadoc/">Link</a></td>`;
42+
htmlString += `<td class="version"><strong><a href="https://github.com/gchq/event-logging/releases/tag/${version}">${version}</a></strong></td>`;
43+
htmlString += `<td><a href="${ghPagesBaseUrl}/${file.path}/swagger-ui/">Link</a></td>`;
44+
htmlString += `<td><a href="${ghPagesBaseUrl}/${file.path}/javadoc/">Link</a></td>`;
2345
htmlString += '</tr>';
2446
}
2547
}
2648

27-
htmlString += '</table>';
28-
document.getElementsByTagName('body')[0].innerHTML = htmlString;
49+
//htmlString += '</table>';
50+
document.getElementById('versions-content').innerHTML = htmlString;
2951
})()
3052
</script>
3153
<body>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
* No change to event-logging library. Fix automated build.
2+
3+
4+
```sh
5+
# ONLY the top line will be included as a change entry in the CHANGELOG.
6+
# The entry should be in GitHub flavour markdown and should be written on a SINGLE
7+
# line with no hard breaks. You can have multiple change files for a single GitHub issue.
8+
# The entry should be written in the imperative mood, i.e. 'Fix nasty bug' rather than
9+
# 'Fixed nasty bug'.
10+
#
11+
# Examples of acceptable entries are:
12+
#
13+
#
14+
# * Issue **123** : Fix bug with an associated GitHub issue in this repository
15+
#
16+
# * Issue **namespace/other-repo#456** : Fix bug with an associated GitHub issue in another repository
17+
#
18+
# * Fix bug with no associated GitHub issue.
19+
```

0 commit comments

Comments
 (0)