diff --git a/data/ui.yml b/data/ui.yml index 0fc2ca6e1eb7..e81055ac2b23 100644 --- a/data/ui.yml +++ b/data/ui.yml @@ -4,6 +4,9 @@ header: notices: ghae_silent_launch: GitHub AE is currently under limited release. Please contact our Sales Team 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 English documentation. - product_in_progress: - 👋 Hello, explorer! This page is under active development. For the - most up-to-date and accurate information, please visit our developer documentation. 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 \ No newline at end of file + reference_guides: Reference guides diff --git a/data/variables/release_candidate.yml b/data/variables/release_candidate.yml new file mode 100644 index 000000000000..026d2f7e61ab --- /dev/null +++ b/data/variables/release_candidate.yml @@ -0,0 +1 @@ +version: '' diff --git a/includes/header-notification.html b/includes/header-notification.html index 416f6686b19c..7c5cc5e8a0f8 100644 --- a/includes/header-notification.html +++ b/includes/header-notification.html @@ -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 %} + + +{% 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 %} diff --git a/script/release-banner.js b/script/release-banner.js new file mode 100755 index 000000000000..b5a1bd414a40 --- /dev/null +++ b/script/release-banner.js @@ -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 ', 'The version the banner applies to. Must be in 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. +`)