build: cleanup release scripts, separate cli entrypoints from logic (#44081)
* build: cleanup release scripts, separate cli entrypoints from logic Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> * build: use repo/org constants Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
This commit is contained in:
parent
2f519a8f2e
commit
98b1d305b6
17 changed files with 410 additions and 300 deletions
|
@ -2,30 +2,10 @@
|
|||
|
||||
import { Octokit } from '@octokit/rest';
|
||||
import * as chalk from 'chalk';
|
||||
import { parseArgs } from 'node:util';
|
||||
|
||||
import { createGitHubTokenStrategy } from './github-token';
|
||||
import { ELECTRON_ORG, ELECTRON_REPO, ElectronReleaseRepo, NIGHTLY_REPO } from './types';
|
||||
|
||||
const { values: { tag: _tag, releaseID } } = parseArgs({
|
||||
options: {
|
||||
tag: {
|
||||
type: 'string'
|
||||
},
|
||||
releaseID: {
|
||||
type: 'string',
|
||||
default: ''
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!_tag) {
|
||||
console.error('Missing --tag argument');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const tag = _tag;
|
||||
|
||||
const pass = chalk.green('✓');
|
||||
const fail = chalk.red('✗');
|
||||
|
||||
|
@ -75,7 +55,12 @@ async function deleteTag (tag: string, targetRepo: ElectronReleaseRepo) {
|
|||
}
|
||||
}
|
||||
|
||||
async function cleanReleaseArtifacts () {
|
||||
type CleanOptions = {
|
||||
releaseID?: string;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
export async function cleanReleaseArtifacts ({ releaseID, tag }: CleanOptions) {
|
||||
const releaseId = releaseID && releaseID.length > 0 ? releaseID : null;
|
||||
const isNightly = tag.includes('nightly');
|
||||
|
||||
|
@ -102,9 +87,3 @@ async function cleanReleaseArtifacts () {
|
|||
|
||||
console.log(`${pass} failed release artifact cleanup complete`);
|
||||
}
|
||||
|
||||
cleanReleaseArtifacts()
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue