Skip to content

Commit 2bf16ab

Browse files
authored
Merge pull request #18322 from github/release-notes-upgrade-notice
GHES release notes upgrade notices
2 parents b012a1b + 14953a1 commit 2bf16ab

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

data/ui.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ header:
1818
please visit our
1919
<a id="to-english-doc" href="/en">English documentation</a>.
2020
early_access: 📣 Please <b>do not share</b> this URL publicly. This page contains content about an early access feature.
21+
ghes_release_notes_use_latest: Please use the latest release for the latest security, performance, and bug fixes.
22+
ghes_release_notes_upgrade_patch_only: 📣 This is not the <a href="#{{ latestPatch }}">latest patch release</a> of Enterprise Server. {% data ui.header.notices.ghes_release_notes_use_latest %}
23+
ghes_release_notes_upgrade_release_only: 📣 This is not the <a href="/enterprise-server@{{ latestRelease }}/admin/release-notes">latest release</a> of Enterprise Server. {% data ui.header.notices.ghes_release_notes_use_latest %}
24+
ghes_release_notes_upgrade_patch_and_release: 📣 This is not the <a href="#{{ latestPatch }}">latest patch release</a> of this release series, and this is not the <a href="/enterprise-server@{{ latestRelease }}/admin/release-notes">latest release</a> of Enterprise Server. {% data ui.header.notices.ghes_release_notes_use_latest %}
2125
search:
2226
need_help: Need help?
2327
placeholder: Search topics, products...

layouts/release-notes.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ <h2 class="border-bottom-0 m-0 p-0">
6060
</div>
6161

6262
<p class="text-gray mt-1">{{ patch.date | date: "%B %d, %Y" }}</p>
63+
64+
{% if patch.version != latestPatch and allVersions[currentVersion].currentRelease == latestRelease %}
65+
<p class="text-gray mt-1">{% data ui.header.notices.ghes_release_notes_upgrade_patch_only %}</p>
66+
{% endif %}
67+
68+
{% if patch.version == latestPatch and allVersions[currentVersion].currentRelease != latestRelease %}
69+
<p class="text-gray mt-1">{% data ui.header.notices.ghes_release_notes_upgrade_release_only %}</p>
70+
{% endif %}
71+
72+
{% if patch.version != latestPatch and allVersions[currentVersion].currentRelease != latestRelease %}
73+
<p class="text-gray mt-1">{% data ui.header.notices.ghes_release_notes_upgrade_patch_and_release %}</p>
74+
{% endif %}
6375
</header>
6476

6577
<div class="container-xl px-3">

middleware/contextualizers/enterprise-release-notes.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const semver = require('semver')
22
const renderContent = require('../../lib/render-content')
33
const patterns = require('../../lib/patterns')
4-
const enterpriseReleases = require('../../lib/enterprise-server-releases').supported
4+
const { supported, latest } = require('../../lib/enterprise-server-releases')
55

66
/**
77
* Turn { [key]: { notes, intro, date } }
@@ -92,7 +92,7 @@ module.exports = async function enterpriseReleaseNotesContext (req, res, next) {
9292
req.context.releaseNotes = await Promise.all(patches.map(async patch => renderPatchNotes(patch, req.context)))
9393

9494
// Put together information about other releases
95-
req.context.releases = enterpriseReleases.map(version => {
95+
req.context.releases = supported.map(version => {
9696
const ret = { version }
9797
if (!req.context.site.data['release-notes']) return ret
9898
const release = req.context.site.data['release-notes'][version.replace(/\./g, '-')]
@@ -101,9 +101,12 @@ module.exports = async function enterpriseReleaseNotesContext (req, res, next) {
101101
return { ...ret, patches }
102102
})
103103

104-
const releaseIndex = enterpriseReleases.findIndex(release => release === requestedVersion)
105-
req.context.nextRelease = enterpriseReleases[releaseIndex - 1]
106-
req.context.prevRelease = enterpriseReleases[releaseIndex + 1]
104+
const releaseIndex = supported.findIndex(release => release === requestedVersion)
105+
req.context.nextRelease = supported[releaseIndex - 1]
106+
req.context.prevRelease = supported[releaseIndex + 1]
107+
108+
req.context.latestPatch = patches[0].version
109+
req.context.latestRelease = latest
107110

108111
return next()
109112
}

0 commit comments

Comments
 (0)