зеркало из https://github.com/github/docs.git
Release candidate banner script (#16427)
* remove middleware that sets notification flags * move all notification handling into includes/header-notification.html * update tests * add release candidate header notification * add release candidate banner text * new script to add or remove a release candidate banner * Update script/release-banner.js Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com> * clarify error message * empty commit to rerun CI Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com>
This commit is contained in:
Родитель
ef9bb5556a
Коммит
712003941f
|
@ -4,6 +4,9 @@ header:
|
|||
notices:
|
||||
ghae_silent_launch:
|
||||
GitHub AE is currently under limited release. Please <a href="https://enterprise.github.com/contact">contact our Sales Team</a> to find out more.
|
||||
release_candidate:
|
||||
# The version name is rendered before the below text via includes/header-notification.html
|
||||
' is currently under limited release as a release candidate.'
|
||||
localization_complete:
|
||||
We publish frequent updates to our documentation, and translation of this page may still be in progress.
|
||||
For the most current information, please visit the
|
||||
|
@ -15,9 +18,6 @@ header:
|
|||
still in translation. For the most up-to-date and accurate information,
|
||||
please visit our
|
||||
<a id="to-english-doc" href="/en">English documentation</a>.
|
||||
product_in_progress:
|
||||
👋 Hello, explorer! This page is under active development. For the
|
||||
most up-to-date and accurate information, please visit our <a href="https://developer.github.com">developer documentation</a>.
|
||||
search:
|
||||
need_help: Need help?
|
||||
placeholder: Search topics, products...
|
||||
|
@ -132,4 +132,4 @@ footer:
|
|||
shop: Shop
|
||||
product_landing:
|
||||
quick_start: Quickstart
|
||||
reference_guides: Reference guides
|
||||
reference_guides: Reference guides
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
version: ''
|
|
@ -21,6 +21,11 @@
|
|||
{% if currentVersion == "github-ae@latest" %}
|
||||
{% assign release_notification_type = "true" %}
|
||||
{% assign release_notification = site.data.ui.header.notices.ghae_silent_launch %}
|
||||
|
||||
<!-- Release candidate notice -->
|
||||
{% elsif currentVersion == site.data.variables.release_candidate.version %}
|
||||
{% assign release_notification_type = "true" %}
|
||||
{% assign release_notification = allVersions[currentVersion].versionTitle | append: site.data.ui.header.notices.release_candidate %}
|
||||
{% endif %}
|
||||
<!-- END RELEASE NOTICES -->
|
||||
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const program = require('commander')
|
||||
const yaml = require('js-yaml')
|
||||
const allVersions = require('../lib/all-versions')
|
||||
const releaseCandidateFile = 'data/variables/release_candidate.yml'
|
||||
const releaseCandidateYaml = path.join(process.cwd(), releaseCandidateFile)
|
||||
|
||||
const allowedActions = ['create', 'remove']
|
||||
|
||||
// [start-readme]
|
||||
//
|
||||
// This script creates or removes a release candidate banner for a specified version.
|
||||
//
|
||||
// [end-readme]
|
||||
|
||||
program
|
||||
.description('Create or remove a release candidate banner for the provided docs version.')
|
||||
// The following two settings let us use `version` as a flag without clashing with reserved opts
|
||||
.storeOptionsAsProperties(false)
|
||||
.passCommandToAction(false)
|
||||
.option(`-a, --action <${allowedActions.join(' or ')}>`, 'Create or remove the banner.')
|
||||
.option('-v, --version <version>', 'The version the banner applies to. Must be in <plan@release> format.')
|
||||
.parse(process.argv)
|
||||
|
||||
const options = program.opts()
|
||||
|
||||
if (!allowedActions.includes(options.action)) {
|
||||
console.log(`Error! You must specify --action <${allowedActions.join(' or ')}>.`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (!(Object.keys(allVersions).includes(options.version))) {
|
||||
console.log('Error! You must specify --version with the full name of a supported version, e.g., enterprise-server@2.22.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// Load the release candidate variable
|
||||
const releaseCandidateData = yaml.safeLoad(fs.readFileSync(releaseCandidateYaml, 'utf8'))
|
||||
|
||||
// Create or remove the variable
|
||||
if (options.action === 'create') {
|
||||
releaseCandidateData.version = options.version
|
||||
}
|
||||
|
||||
if (options.action === 'remove') {
|
||||
releaseCandidateData.version = ''
|
||||
}
|
||||
|
||||
// Update the file
|
||||
fs.writeFileSync(releaseCandidateYaml, yaml.safeDump(releaseCandidateData))
|
||||
|
||||
// Display next steps
|
||||
console.log(`\nDone! Commit the update to ${releaseCandidateFile}. This ${options.action}s the banner for ${options.version}.
|
||||
|
||||
- To change the banner text, you can edit header.notices.release_candidate in data/ui.yml.
|
||||
- To change the banner styling, you can edit includes/header-notification.html.
|
||||
`)
|
Загрузка…
Ссылка в новой задаче