Skip to content

repo sync #1318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions data/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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...
Expand Down Expand Up @@ -132,4 +132,4 @@ footer:
shop: Shop
product_landing:
quick_start: Quickstart
reference_guides: Reference guides
reference_guides: Reference guides
1 change: 1 addition & 0 deletions data/variables/release_candidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: ''
5 changes: 5 additions & 0 deletions includes/header-notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->

Expand Down
60 changes: 60 additions & 0 deletions script/release-banner.js
Original file line number Diff line number Diff line change
@@ -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.
`)