@@ -117,9 +117,15 @@ const sliceUploadFile = function (cos, options) {
117117 return new Promise ( ( resolve , reject ) => {
118118 cos . sliceUploadFile ( options , ( err , info ) => {
119119 if ( err ) {
120- reject ( err ) ;
120+ resolve ( {
121+ code : 1 ,
122+ data : err ,
123+ } ) ;
121124 } else {
122- resolve ( info ) ;
125+ resolve ( {
126+ code : 0 ,
127+ data : info ,
128+ } ) ;
123129 }
124130 } ) ;
125131 } ) ;
@@ -192,19 +198,27 @@ const initCos = async () => {
192198 try {
193199 let info = await Promise . all ( uploadActions ) ;
194200
195- info . forEach ( ( item ) => {
196- logTimeResult ( `${ item . Location } -${ item . statusCode } ` ) ;
201+ info . forEach ( ( result ) => {
202+ if ( ! result . code ) {
203+ let item = result . data ;
204+ logTimeResult ( `${ item . Location } -${ item . statusCode } ` ) ;
197205
198- let splitResult = item . Location . split ( '/' ) ;
199- let file = splitResult . splice ( 1 , splitResult . length - 1 ) . join ( '/' ) ;
206+ let splitResult = item . Location . split ( '/' ) ;
207+ let file = splitResult . splice ( 1 , splitResult . length - 1 ) . join ( '/' ) ;
200208
201- if ( path . extname ( file ) !== '.html' ) {
202- assetJsonMap . map . push ( file ) ;
209+ if ( path . extname ( file ) !== '.html' ) {
210+ assetJsonMap . map . push ( file ) ;
211+ }
212+ incrementalFiles . push ( file ) ;
213+ } else {
214+ core . debug ( result . data ) ;
203215 }
204- incrementalFiles . push ( file ) ;
205216 } ) ;
206217
207- core . setOutput ( 'deployResult' , JSON . stringify ( incrementalFiles ) ) ;
218+ core . setOutput (
219+ 'deployResult' ,
220+ 'success: ' + JSON . stringify ( incrementalFiles )
221+ ) ;
208222 } catch ( e ) {
209223 logTimeResult ( `${ e . Key } -${ e . statusCode } -${ e . Code } ` , 'error' ) ;
210224 core . error ( e . message ) ;
0 commit comments