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