From 267c0796dd779aa443d7d17f2eae23972bd7d083 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 27 Feb 2024 19:55:08 -0500 Subject: [PATCH] ci: add logging to uploading to GitHub releases (#41453) --- script/release/uploaders/upload-to-github.ts | 7 ++++++- script/release/uploaders/upload.py | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/script/release/uploaders/upload-to-github.ts b/script/release/uploaders/upload-to-github.ts index fa515441f8f8..2c51370983c3 100644 --- a/script/release/uploaders/upload-to-github.ts +++ b/script/release/uploaders/upload-to-github.ts @@ -27,7 +27,9 @@ const getHeaders = (filePath: string, fileName: string) => { if (!extension) { throw new Error(`Failed to get headers for extensionless file: ${fileName}`); } + console.log(`About to get size of ${filePath}`); const size = fs.statSync(filePath).size; + console.log(`Got size of ${filePath}: ${size}`); const options: Record = { json: 'text/json', zip: 'application/zip', @@ -46,10 +48,13 @@ const uploadUrl = `https://uploads.github.com/repos/electron/${targetRepo}/relea let retry = 0; function uploadToGitHub () { + console.log(`in uploadToGitHub for ${filePath}, ${fileName}`); + const fileData = fs.createReadStream(filePath); + console.log(`in uploadToGitHub, created readstream for ${filePath}`); octokit.repos.uploadReleaseAsset({ url: uploadUrl, headers: getHeaders(filePath, fileName), - data: fs.createReadStream(filePath) as any, + data: fileData as any, name: fileName, owner: 'electron', repo: targetRepo, diff --git a/script/release/uploaders/upload.py b/script/release/uploaders/upload.py index d5c3b6a16a15..621551625e29 100755 --- a/script/release/uploaders/upload.py +++ b/script/release/uploaders/upload.py @@ -362,10 +362,13 @@ def upload_io_to_github(release, filename, filepath, version): (filename)) script_path = os.path.join( ELECTRON_DIR, 'script', 'release', 'uploaders', 'upload-to-github.ts') - upload_gh_output = execute([TS_NODE, script_path, filepath, filename, - str(release['id']), version]) + upload_process = subprocess.Popen([TS_NODE, script_path, filepath, filename, + str(release['id']), version], stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) if is_verbose_mode(): - print(upload_gh_output) + for c in iter(lambda: upload_process.stdout.read(1), b""): + sys.stdout.buffer.write(c) + sys.stdout.flush() def upload_sha256_checksum(version, file_path, key_prefix=None):