build: cleanup release scripts, separate cli entrypoints from logic (#44083)
build: cleanup release scripts, separate cli entrypoints from logic (#44058) * build: cleanup release scripts, separate cli entrypoints from logic * build: use repo/org constants
This commit is contained in:
parent
075a297347
commit
01e64d3932
17 changed files with 408 additions and 299 deletions
|
@ -1,7 +1,7 @@
|
|||
import { Octokit } from '@octokit/rest';
|
||||
import * as fs from 'node:fs';
|
||||
import { createGitHubTokenStrategy } from '../github-token';
|
||||
import { ELECTRON_REPO, ElectronReleaseRepo, NIGHTLY_REPO } from '../types';
|
||||
import { ELECTRON_ORG, ELECTRON_REPO, ElectronReleaseRepo, NIGHTLY_REPO } from '../types';
|
||||
|
||||
if (process.argv.length < 6) {
|
||||
console.log('Usage: upload-to-github filePath fileName releaseId');
|
||||
|
@ -60,7 +60,7 @@ function uploadToGitHub () {
|
|||
headers: getHeaders(filePath, fileName),
|
||||
data: fileData as any,
|
||||
name: fileName,
|
||||
owner: 'electron',
|
||||
owner: ELECTRON_ORG,
|
||||
repo: targetRepo,
|
||||
release_id: releaseId
|
||||
}).then(() => {
|
||||
|
@ -72,7 +72,7 @@ function uploadToGitHub () {
|
|||
retry++;
|
||||
|
||||
octokit.repos.listReleaseAssets({
|
||||
owner: 'electron',
|
||||
owner: ELECTRON_ORG,
|
||||
repo: targetRepo,
|
||||
release_id: releaseId,
|
||||
per_page: 100
|
||||
|
@ -84,7 +84,7 @@ function uploadToGitHub () {
|
|||
if (existingAssets.length > 0) {
|
||||
console.log(`${fileName} already exists; will delete before retrying upload.`);
|
||||
octokit.repos.deleteReleaseAsset({
|
||||
owner: 'electron',
|
||||
owner: ELECTRON_ORG,
|
||||
repo: targetRepo,
|
||||
asset_id: existingAssets[0].id
|
||||
}).catch((deleteErr) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue