From 8abbb51560f928037901938ad93e1313408d6f24 Mon Sep 17 00:00:00 2001 From: Stanislav Date: Fri, 30 Apr 2021 15:21:43 +0200 Subject: [PATCH] Update changelog parser to respect rc (https://github.com/enso-org/ide/pull/1535) Original commit: https://github.com/enso-org/ide/commit/9d40adeb62be328883317e8322e996290ce1c94a --- gui/build/release.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/gui/build/release.js b/gui/build/release.js index bb11362e47..387ee6f0f6 100644 --- a/gui/build/release.js +++ b/gui/build/release.js @@ -33,12 +33,14 @@ class NextReleaseVersion { } class Version { - constructor(major,minor,patch,tag,tagVersion) { - this.major = major - this.minor = minor - this.patch = patch - this.tag = tag - this.tagVersion = tagVersion + constructor(major,minor,patch,tag,tagVersion,rcTag,rcTagVersion) { + this.major = major + this.minor = minor + this.patch = patch + this.tag = tag + this.tagVersion = tagVersion + this.rcTag = rcTag + this.rcTagVersion = rcTagVersion } lt(that) { @@ -48,7 +50,8 @@ class Version { if (this.tag === 'alpha' && that.tag === 'beta') { return true } if (this.tag === 'alpha' && that.tag === 'rc') { return true } if (this.tag === 'beta' && that.tag === 'rc') { return true } - if (this.tagVersion < that.tagVersion) { return true } + if (this.tagVersion < that.tagVersion) { return true } + if (this.rcTagVersion < that.rcTagVersion) { return true } return false } @@ -60,6 +63,9 @@ class Version { let suffix = '' if (this.tag) { suffix = `-${this.tag}.${this.tagVersion}` + if (this.rcTag) { + suffix += `.${this.rcTag}.${this.rcTagVersion}` + } } return `${this.major}.${this.minor}.${this.patch}${suffix}` } @@ -140,13 +146,13 @@ function changelogEntries() { let version = new NextReleaseVersion entries.push(new ChangelogEntry(version,body)) } else { - let headerReg = /^ Enso (?[0-9]+)\.(?[0-9]+)\.(?[0-9]+)(-(?alpha|beta|rc)\.(?[0-9]+))? \((?[0-9][0-9][0-9][0-9])-(?[0-9][0-9])-(?[0-9][0-9])\)/ + let headerReg = /^ Enso (?[0-9]+)\.(?[0-9]+)\.(?[0-9]+)(-(?alpha|beta|rc)\.(?[0-9]+))?(.(?rc)\.(?[0-9]+))? \((?[0-9][0-9][0-9][0-9])-(?[0-9][0-9])-(?[0-9][0-9])\)/ let match = header.match(headerReg) if (!match) { throw `Improper changelog entry header: '${header}'. See the 'CHANGELOG_TEMPLATE.md' for details.` } let grps = match.groups - let version = new Version(grps.major,grps.minor,grps.patch,grps.tag,grps.tagVersion) + let version = new Version(grps.major,grps.minor,grps.patch,grps.tag,grps.tagVersion,grps.rcTag,grps.rcTagVersion) entries.push(new ChangelogEntry(version,body)) } firstSection = false