From c0657a4ca7614119e22f41c002bce2aba82ec3fc Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 12 Nov 2019 08:36:03 -0800 Subject: [PATCH] build: fix nightly version bumping (#21079) * build: fix nightly version bumping * spec: add a test for bumping nightlies beyond the 8-x-y branch switch * Update version-bump-spec.ts --- script/release/version-utils.js | 4 ++-- spec-main/version-bump-spec.ts | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/script/release/version-utils.js b/script/release/version-utils.js index 3c4d3555441..6d4edeb757a 100644 --- a/script/release/version-utils.js +++ b/script/release/version-utils.js @@ -72,7 +72,7 @@ async function nextNightly (v) { async function getLastMajorForMaster () { let branchNames - const result = await GitProcess.exec(['branch', '-a', '--remote', '--list', 'origin/[0-9]-[0-9]-x'], ELECTRON_DIR) + const result = await GitProcess.exec(['branch', '-a', '--remote', '--list', 'origin/[0-9]*-x-y'], ELECTRON_DIR) if (result.exitCode === 0) { branchNames = result.stdout.trim().split('\n') const filtered = branchNames.map(b => b.replace('origin/', '')) @@ -83,7 +83,7 @@ async function getLastMajorForMaster () { } function getNextReleaseBranch (branches) { - const converted = branches.map(b => b.replace(/-/g, '.').replace('x', '0')) + const converted = branches.map(b => b.replace(/-/g, '.').replace('x', '0').replace('y', '0')) return converted.reduce((v1, v2) => semver.gt(v1, v2) ? v1 : v2) } diff --git a/spec-main/version-bump-spec.ts b/spec-main/version-bump-spec.ts index d5cf28d1b1f..857ddd1d4d5 100644 --- a/spec-main/version-bump-spec.ts +++ b/spec-main/version-bump-spec.ts @@ -68,6 +68,13 @@ describe('version-bumper', () => { expect(matches).to.have.lengthOf(1) }) + it('bumps to a nightly version above our switch from N-0-x to N-x-y branch names', async () => { + const version = 'v2.0.0-nightly.19950901' + const next = await nextVersion('nightly', version) + // If it starts with v8 then we didn't bump above the 8-x-y branch + expect(next.startsWith('v8')).to.equal(false) + }) + it('throws error when bumping to beta from stable', () => { const version = 'v2.0.0' return expect(