Skip to content

Commit c510679

Browse files
authored
repo sync
2 parents 09544a5 + 7120039 commit c510679

File tree

4 files changed

+70
-4
lines changed

4 files changed

+70
-4
lines changed

data/ui.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ header:
44
notices:
55
ghae_silent_launch:
66
GitHub AE is currently under limited release. Please <a href="https://enterprise.github.com/contact">contact our Sales Team</a> to find out more.
7+
release_candidate:
8+
# The version name is rendered before the below text via includes/header-notification.html
9+
' is currently under limited release as a release candidate.'
710
localization_complete:
811
We publish frequent updates to our documentation, and translation of this page may still be in progress.
912
For the most current information, please visit the
@@ -15,9 +18,6 @@ header:
1518
still in translation. For the most up-to-date and accurate information,
1619
please visit our
1720
<a id="to-english-doc" href="/en">English documentation</a>.
18-
product_in_progress:
19-
👋 Hello, explorer! This page is under active development. For the
20-
most up-to-date and accurate information, please visit our <a href="https://developer.github.com">developer documentation</a>.
2121
search:
2222
need_help: Need help?
2323
placeholder: Search topics, products...
@@ -132,4 +132,4 @@ footer:
132132
shop: Shop
133133
product_landing:
134134
quick_start: Quickstart
135-
reference_guides: Reference guides
135+
reference_guides: Reference guides

data/variables/release_candidate.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version: ''

includes/header-notification.html

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
{% if currentVersion == "github-ae@latest" %}
2222
{% assign release_notification_type = "true" %}
2323
{% assign release_notification = site.data.ui.header.notices.ghae_silent_launch %}
24+
25+
<!-- Release candidate notice -->
26+
{% elsif currentVersion == site.data.variables.release_candidate.version %}
27+
{% assign release_notification_type = "true" %}
28+
{% assign release_notification = allVersions[currentVersion].versionTitle | append: site.data.ui.header.notices.release_candidate %}
2429
{% endif %}
2530
<!-- END RELEASE NOTICES -->
2631

script/release-banner.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs')
4+
const path = require('path')
5+
const program = require('commander')
6+
const yaml = require('js-yaml')
7+
const allVersions = require('../lib/all-versions')
8+
const releaseCandidateFile = 'data/variables/release_candidate.yml'
9+
const releaseCandidateYaml = path.join(process.cwd(), releaseCandidateFile)
10+
11+
const allowedActions = ['create', 'remove']
12+
13+
// [start-readme]
14+
//
15+
// This script creates or removes a release candidate banner for a specified version.
16+
//
17+
// [end-readme]
18+
19+
program
20+
.description('Create or remove a release candidate banner for the provided docs version.')
21+
// The following two settings let us use `version` as a flag without clashing with reserved opts
22+
.storeOptionsAsProperties(false)
23+
.passCommandToAction(false)
24+
.option(`-a, --action <${allowedActions.join(' or ')}>`, 'Create or remove the banner.')
25+
.option('-v, --version <version>', 'The version the banner applies to. Must be in <plan@release> format.')
26+
.parse(process.argv)
27+
28+
const options = program.opts()
29+
30+
if (!allowedActions.includes(options.action)) {
31+
console.log(`Error! You must specify --action <${allowedActions.join(' or ')}>.`)
32+
process.exit(1)
33+
}
34+
35+
if (!(Object.keys(allVersions).includes(options.version))) {
36+
console.log('Error! You must specify --version with the full name of a supported version, e.g., enterprise-server@2.22.')
37+
process.exit(1)
38+
}
39+
40+
// Load the release candidate variable
41+
const releaseCandidateData = yaml.safeLoad(fs.readFileSync(releaseCandidateYaml, 'utf8'))
42+
43+
// Create or remove the variable
44+
if (options.action === 'create') {
45+
releaseCandidateData.version = options.version
46+
}
47+
48+
if (options.action === 'remove') {
49+
releaseCandidateData.version = ''
50+
}
51+
52+
// Update the file
53+
fs.writeFileSync(releaseCandidateYaml, yaml.safeDump(releaseCandidateData))
54+
55+
// Display next steps
56+
console.log(`\nDone! Commit the update to ${releaseCandidateFile}. This ${options.action}s the banner for ${options.version}.
57+
58+
- To change the banner text, you can edit header.notices.release_candidate in data/ui.yml.
59+
- To change the banner styling, you can edit includes/header-notification.html.
60+
`)

0 commit comments

Comments
 (0)