ci: add logging to uploading to GitHub releases (#41455)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
trop[bot] 2024-02-28 11:39:52 +09:00 committed by GitHub
parent 7331e5dfb1
commit 47deb401b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View file

@ -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<string, string> = {
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,