Browse Source

refactor: version-utils respects main (#29393)

Co-authored-by: Jeremy Rose <[email protected]>
trop[bot] 3 years ago
parent
commit
b4131bb4a0
1 changed files with 4 additions and 3 deletions
  1. 4 3
      script/release/version-utils.js

+ 4 - 3
script/release/version-utils.js

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