1
0
mirror of synced 2026-01-02 21:04:32 -05:00

Merge pull request #10081 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2021-09-15 16:45:01 -04:00
committed by GitHub
2 changed files with 39 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ export const dates = JSON.parse(
// Some frontmatter may contain the upcoming GHES release number
export const next = '3.3'
export const nextNext = '3.4'
export const supported = ['3.2', '3.1', '3.0', '2.22']
export const deprecated = [
@@ -78,6 +79,7 @@ export const getPreviousReleaseNumber = (releaseNum) => {
export default {
next,
nextNext,
supported,
deprecated,
legacyAssetVersions,

View File

@@ -19,10 +19,12 @@ import renderContent from '../../lib/render-content/index.js'
import getApplicableVersions from '../../lib/get-applicable-versions.js'
import { execSync } from 'child_process'
import { allVersions } from '../../lib/all-versions.js'
import { supported, next, deprecated } from '../../lib/enterprise-server-releases.js'
import { supported, next, nextNext, deprecated } from '../../lib/enterprise-server-releases.js'
import { getLiquidConditionals } from '../../script/helpers/get-liquid-conditionals.js'
import allowedVersionOperators from '../../lib/liquid-tags/ifversion-supported-operators.js'
import { isExperimental } from '../helpers/is-experimental.js'
import semver from 'semver'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const enterpriseServerVersions = Object.keys(allVersions).filter((v) =>
v.startsWith('enterprise-server@')
@@ -1106,12 +1108,25 @@ function validateIfversionConditionals(conds) {
`Found a "${operator}" operator inside "${cond}", but "${operator}" is not supported`
)
}
// Check nextNext is one version ahead of next
if (!isNextVersion(next, nextNext)) {
errors.push(
`The nextNext version: "${nextNext} is not one version ahead of the next supported version: "${next}" - check lib/enterprise-server-releases.js`
)
}
// Check that the versions in conditionals are supported
// versions of GHES or the first deprecated version. Allowing
// the first deprecated version to exist in code ensures
// allows us to deprecate the version before removing
// the old liquid content.
if (!(supported.includes(release) || release === next || deprecated[0] === release)) {
if (
!(
supported.includes(release) ||
release === next ||
release === nextNext ||
deprecated[0] === release
)
) {
errors.push(
`Found ${release} inside "${cond}", but ${release} is not a supported GHES release`
)
@@ -1122,3 +1137,23 @@ function validateIfversionConditionals(conds) {
return errors
}
function isNextVersion(v1, v2) {
const semverNext = semver.coerce(v1)
const semverNextNext = semver.coerce(v2)
const semverSupported = []
supported.forEach((el, i) => {
semverSupported[i] = semver.coerce(el)
})
// Check that the next version is the next version from the supported list first
const maxVersion = semver.maxSatisfying(semverSupported, '*').raw
const nextVersionCheck =
semverNext.raw === semver.inc(maxVersion, 'minor') ||
semverNext.raw === semver.inc(maxVersion, 'major')
return (
nextVersionCheck &&
(semver.inc(semverNext, 'minor') === semverNextNext.raw ||
semver.inc(semverNext, 'major') === semverNextNext.raw)
)
}