File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -9,16 +9,16 @@ async function run(): Promise<void> {
9
9
const bucket = core . getInput ( 'bucket' ) ;
10
10
const sourceDir = core . getInput ( 'source_dir' ) ;
11
11
const destDir = core . getInput ( 'dest_dir' ) ;
12
- const ignoreSourceMap = core . getInput ( 'ignore_source_map' ) ;
12
+ const ignoreSourceMap = core . getInput ( 'ignore_source_map' ) === 'true' ;
13
13
14
14
const token = genToken ( bucket , ak , sk ) ;
15
15
16
16
upload (
17
17
token ,
18
18
sourceDir ,
19
19
destDir ,
20
- Boolean ( ignoreSourceMap ) ,
21
- ( file , key ) => core . info ( `success: ${ file } => ${ key } ` ) ,
20
+ ignoreSourceMap ,
21
+ ( file , key ) => core . info ( `success: ${ file } => [ ${ bucket } ]: ${ key } ` ) ,
22
22
( ) => core . info ( 'Done!' ) ,
23
23
( error ) => core . setFailed ( error . message ) ,
24
24
) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,14 @@ import glob from 'glob';
4
4
import pAll from 'p-all' ;
5
5
import pRetry from 'p-retry' ;
6
6
7
+ function normalizePath ( input : string ) : string {
8
+ let val = input . replace ( / ^ \/ / , '' ) ;
9
+ if ( ! val . endsWith ( '/' ) ) {
10
+ val += '/' ;
11
+ }
12
+ return val ;
13
+ }
14
+
7
15
export function upload (
8
16
token : string ,
9
17
srcDir : string ,
@@ -22,7 +30,7 @@ export function upload(
22
30
23
31
const tasks = files . map ( ( file ) => {
24
32
const relativePath = path . relative ( baseDir , path . dirname ( file ) ) ;
25
- const key = path . join ( destDir , relativePath , path . basename ( file ) ) ;
33
+ const key = normalizePath ( path . join ( destDir , relativePath , path . basename ( file ) ) ) ;
26
34
27
35
if ( ignoreSourceMap && file . endsWith ( '.map' ) ) return null ;
28
36
You can’t perform that action at this time.
0 commit comments