build: remove older branch migration helpers (#36888)
* build: remove older branch migration helpers * chore: fix typo
This commit is contained in:
parent
3f764cbbd5
commit
c953109f01
4 changed files with 10 additions and 19 deletions
|
@ -6,11 +6,6 @@ const path = require('path');
|
|||
const ELECTRON_DIR = path.resolve(__dirname, '..', '..');
|
||||
const SRC_DIR = path.resolve(ELECTRON_DIR, '..');
|
||||
|
||||
const RELEASE_BRANCH_PATTERN = /(\d)+-(?:(?:[0-9]+-x$)|(?:x+-y$))/;
|
||||
// TODO(main-migration): Simplify once main branch is renamed
|
||||
const MAIN_BRANCH_PATTERN = /^(main|master)$/;
|
||||
const ORIGIN_MAIN_BRANCH_PATTERN = /^origin\/(main|master)$/;
|
||||
|
||||
require('colors');
|
||||
const pass = '✓'.green;
|
||||
const fail = '✗'.red;
|
||||
|
@ -76,6 +71,10 @@ async function handleGitCall (args, gitDir) {
|
|||
}
|
||||
|
||||
async function getCurrentBranch (gitDir) {
|
||||
const RELEASE_BRANCH_PATTERN = /^\d+-x-y$/;
|
||||
const MAIN_BRANCH_PATTERN = /^main$/;
|
||||
const ORIGIN_MAIN_BRANCH_PATTERN = /^origin\/main$/;
|
||||
|
||||
let branch = await handleGitCall(['rev-parse', '--abbrev-ref', 'HEAD'], gitDir);
|
||||
if (!MAIN_BRANCH_PATTERN.test(branch) && !RELEASE_BRANCH_PATTERN.test(branch)) {
|
||||
const lastCommit = await handleGitCall(['rev-parse', 'HEAD'], gitDir);
|
||||
|
|
|
@ -76,8 +76,7 @@ const getAllBranches = async () => {
|
|||
return branches.split('\n')
|
||||
.map(branch => branch.trim())
|
||||
.filter(branch => !!branch)
|
||||
// TODO(main-migration): Simplify once branch rename is complete.
|
||||
.filter(branch => branch !== 'origin/HEAD -> origin/master' && branch !== 'origin/HEAD -> origin/main')
|
||||
.filter(branch => branch !== 'origin/HEAD -> origin/main')
|
||||
.sort();
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch all branches');
|
||||
|
@ -86,8 +85,7 @@ const getAllBranches = async () => {
|
|||
};
|
||||
|
||||
const getStabilizationBranches = async () => {
|
||||
return (await getAllBranches())
|
||||
.filter(branch => /^origin\/\d+-\d+-x$/.test(branch) || /^origin\/\d+-x-y$/.test(branch));
|
||||
return (await getAllBranches()).filter(branch => /^origin\/\d+-x-y$/.test(branch));
|
||||
};
|
||||
|
||||
const getPreviousStabilizationBranch = async (current) => {
|
||||
|
|
|
@ -132,13 +132,8 @@ new Promise((resolve, reject) => {
|
|||
const currentBranch = await getCurrentBranch();
|
||||
|
||||
if (isNightlyElectronVersion) {
|
||||
// TODO(main-migration): Simplify once main branch is renamed.
|
||||
if (currentBranch === 'master' || currentBranch === 'main') {
|
||||
// Nightlies get published to their own module, so they should be tagged as latest
|
||||
npmTag = 'latest';
|
||||
} else {
|
||||
npmTag = `nightly-${currentBranch}`;
|
||||
}
|
||||
// Nightlies get published to their own module, so they should be tagged as latest
|
||||
npmTag = currentBranch === 'main' ? 'latest' : `nightly-${currentBranch}`;
|
||||
|
||||
const currentJson = JSON.parse(fs.readFileSync(path.join(tempDir, 'package.json'), 'utf8'));
|
||||
currentJson.name = 'electron-nightly';
|
||||
|
@ -149,7 +144,7 @@ new Promise((resolve, reject) => {
|
|||
JSON.stringify(currentJson, null, 2)
|
||||
);
|
||||
} else {
|
||||
if (currentBranch === 'master' || currentBranch === 'main') {
|
||||
if (currentBranch === 'main') {
|
||||
// This should never happen, main releases should be nightly releases
|
||||
// this is here just-in-case
|
||||
throw new Error('Unreachable release phase, can\'t tag a non-nightly release on the main branch');
|
||||
|
|
|
@ -73,8 +73,7 @@ async function nextNightly (v) {
|
|||
const pre = `nightly.${getCurrentDate()}`;
|
||||
|
||||
const branch = (await GitProcess.exec(['rev-parse', '--abbrev-ref', 'HEAD'], ELECTRON_DIR)).stdout.trim();
|
||||
// TODO(main-migration): Simplify once main branch is renamed
|
||||
if (branch === 'master' || branch === 'main') {
|
||||
if (branch === 'main') {
|
||||
next = semver.inc(await getLastMajorForMain(), 'major');
|
||||
} else if (isStable(v)) {
|
||||
next = semver.inc(next, 'patch');
|
||||
|
|
Loading…
Reference in a new issue