refactor: version-utils respects main (#29374)

This commit is contained in:
Jeremy Rose 2021-05-27 17:32:37 -07:00 committed by GitHub
parent f664f37793
commit 1373a030b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,8 +65,9 @@ async function nextNightly (v) {
const pre = `nightly.${getCurrentDate()}`; const pre = `nightly.${getCurrentDate()}`;
const branch = (await GitProcess.exec(['rev-parse', '--abbrev-ref', 'HEAD'], ELECTRON_DIR)).stdout.trim(); const branch = (await GitProcess.exec(['rev-parse', '--abbrev-ref', 'HEAD'], ELECTRON_DIR)).stdout.trim();
if (branch === 'master') { // TODO(main-migration): Simplify once main branch is renamed
next = semver.inc(await getLastMajorForMaster(), 'major'); if (branch === 'master' || branch === 'main') {
next = semver.inc(await getLastMajorForMain(), 'major');
} else if (isStable(v)) { } else if (isStable(v)) {
next = semver.inc(next, 'patch'); next = semver.inc(next, 'patch');
} }
@ -74,7 +75,7 @@ async function nextNightly (v) {
return `${next}-${pre}`; return `${next}-${pre}`;
} }
async function getLastMajorForMaster () { async function getLastMajorForMain () {
let branchNames; let branchNames;
const result = await GitProcess.exec(['branch', '-a', '--remote', '--list', 'origin/[0-9]*-x-y'], ELECTRON_DIR); const result = await GitProcess.exec(['branch', '-a', '--remote', '--list', 'origin/[0-9]*-x-y'], ELECTRON_DIR);
if (result.exitCode === 0) { if (result.exitCode === 0) {