@@ -20,15 +20,24 @@ module.exports = async function({ github, glob, workspace, context }) {
2020
2121 const params = { owner, release_id : release . id , repo } ;
2222
23- // Create or fetch artifacts
24- await singleFileBuild ( { outfile } ) ;
25- await copyFile ( `${ cwd } /core/pfe-styles/pfe.min.css` , `${ cwd } /pfe.min.css` ) ;
23+ if ( ! release . assets . some ( x => x . name === 'pfe.min.tgz' ) ) {
24+ // Create or fetch artifacts
25+ await singleFileBuild ( { outfile } ) ;
26+ await copyFile ( `${ cwd } /core/pfe-styles/pfe.min.css` , `${ cwd } /pfe.min.css` ) ;
2627
27- const globber = await glob . create ( 'pfe.min.*' ) ;
28- const files = await globber . glob ( ) ?? [ ] ;
28+ const globber = await glob . create ( 'pfe.min.*' ) ;
29+ const files = await globber . glob ( ) ?? [ ] ;
2930
30- console . log ( 'Creating tarball for' , files . join ( ', ' ) ) ; // eslint-disable-line
31- await tar . c ( { gzip : true , file : 'pfe.min.tgz' } , files ) ;
31+ console . log ( 'Creating tarball for' , files . join ( ', ' ) ) ; // eslint-disable-line
32+ await tar . c ( { gzip : true , file : 'pfe.min.tgz' } , files ) ;
33+
34+ // Upload the all-repo bundle to the release
35+ await github . rest . repos . uploadReleaseAsset ( {
36+ ...params ,
37+ name : 'pfe.min.tgz' ,
38+ data : await readFile ( `${ cwd } /pfe.min.tgz` ) ,
39+ } ) ;
40+ }
3241
3342 // download the tarball that was published to NPM
3443 const { stdout } = await execaCommand ( `npm pack ${ tag } ` ) ;
@@ -38,17 +47,12 @@ module.exports = async function({ github, glob, workspace, context }) {
3847 // Upload the NPM tarball to the release
3948 if ( match ) {
4049 const [ name ] = match ;
41- await github . rest . repos . uploadReleaseAsset ( {
42- ...params ,
43- name,
44- data : await readFile ( `${ cwd } /${ name } ` ) ,
45- } ) ;
50+ if ( ! release . assets . some ( x => x . name === name ) ) {
51+ await github . rest . repos . uploadReleaseAsset ( {
52+ ...params ,
53+ name,
54+ data : await readFile ( `${ cwd } /${ name } ` ) ,
55+ } ) ;
56+ }
4657 }
47-
48- // Upload the all-repo bundle to the release
49- await github . rest . repos . uploadReleaseAsset ( {
50- ...params ,
51- name : 'pfe.min.tgz' ,
52- data : await readFile ( `${ cwd } /pfe.min.tgz` ) ,
53- } ) ;
5458} ;
0 commit comments