@@ -34,20 +34,24 @@ function uploadToGitHub () {
3434 console . log ( `Error uploading ${ fileName } to GitHub, will retry. Error was:` , err )
3535 retry ++
3636 github . repos . getRelease ( githubOpts ) . then ( release => {
37+ console . log ( 'Got list of assets for existing release:' )
38+ console . log ( JSON . stringify ( release . data . assets , null , ' ' ) )
3739 const existingAssets = release . data . assets . filter ( asset => asset . name === fileName )
38- console . log ( 'There are' , release . data . assets . length , 'existing releases' )
39- console . log ( JSON . stringify ( release . data . assets ) )
40- console . log ( githubOpts )
4140 if ( existingAssets . length > 0 ) {
4241 console . log ( `${ fileName } already exists; will delete before retrying upload.` )
4342 github . repos . deleteAsset ( {
4443 owner : 'electron' ,
4544 repo : targetRepo ,
4645 id : existingAssets [ 0 ] . id
47- } ) . then ( uploadToGitHub ) . catch ( uploadToGitHub )
46+ } ) . catch ( ( deleteErr ) => {
47+ console . log ( `Failed to delete existing asset ${ fileName } . Error was:` , deleteErr )
48+ } ) . then ( uploadToGitHub )
4849 } else {
50+ console . log ( `Current asset ${ fileName } not found in existing assets; retrying upload.` )
4951 uploadToGitHub ( )
5052 }
53+ } ) . catch ( ( getReleaseErr ) => {
54+ console . log ( `Fatal: Unable to get current release assets via getRelease! Error was:` , getReleaseErr )
5155 } )
5256 } else {
5357 console . log ( `Error retrying uploading ${ fileName } to GitHub:` , err )
0 commit comments