@@ -97,17 +97,24 @@ const main = async () => {
9797 let params = buildParameters ( ) ;
9898
9999 // Multi-arch target is now handled in GitHub Actions workflow
100-
100+
101+ // Download icon in parallel with parameter preparation if needed
102+ let iconPromise = null ;
101103 if ( process . env . ICON && process . env . ICON !== "" ) {
102104 const iconFile = getIconFileName ( ) ;
103- const iconParams = await downloadIcon ( iconFile ) ;
104- params . push ( ...iconParams ) ;
105+ iconPromise = downloadIcon ( iconFile ) ;
105106 } else {
106107 console . log (
107108 "Won't download the icon as ICON environment variable is not defined!" ,
108109 ) ;
109110 }
110111
112+ // If icon is being downloaded, wait for it and add to params
113+ if ( iconPromise ) {
114+ const iconParams = await iconPromise ;
115+ params . push ( ...iconParams ) ;
116+ }
117+
111118 console . log ( "Pake parameters:" , params . join ( " " ) ) ;
112119 console . log ( "Compiling...." ) ;
113120
@@ -119,14 +126,45 @@ const main = async () => {
119126 fs . mkdirSync ( "output" ) ;
120127 }
121128
122- // Move built files to output directory
129+ // Move built files to output directory more efficiently
130+ const buildPaths = [
131+ `src-tauri/target/release/bundle` ,
132+ `src-tauri/target/universal-apple-darwin/release/bundle`
133+ ] ;
134+
135+ for ( const buildPath of buildPaths ) {
136+ if ( fs . existsSync ( buildPath ) ) {
137+ const bundleFiles = fs . readdirSync ( buildPath , { recursive : true } )
138+ . filter ( file => {
139+ const fullPath = path . join ( buildPath , file ) ;
140+ return fs . statSync ( fullPath ) . isFile ( ) &&
141+ ( file . endsWith ( '.dmg' ) || file . endsWith ( '.exe' ) ||
142+ file . endsWith ( '.deb' ) || file . endsWith ( '.rpm' ) || file . endsWith ( '.AppImage' ) ) ;
143+ } ) ;
144+
145+ for ( const file of bundleFiles ) {
146+ const srcPath = path . join ( buildPath , file ) ;
147+ const destPath = path . join ( "output" , path . basename ( file ) ) ;
148+ await execa ( "cp" , [ srcPath , destPath ] ) ;
149+ }
150+ break ; // Found files, no need to check other paths
151+ }
152+ }
153+
154+ // Fallback to original method if no bundle files found
123155 const files = fs . readdirSync ( "." ) ;
124156 const namePattern = new RegExp ( `^${ process . env . NAME } \\..*$` ) ;
157+ let foundFiles = false ;
125158 for ( const file of files ) {
126159 if ( namePattern . test ( file ) ) {
127160 await execa ( "mv" , [ file , path . join ( "output" , file ) ] ) ;
161+ foundFiles = true ;
128162 }
129163 }
164+
165+ if ( ! foundFiles ) {
166+ console . log ( "Warning: No output files found matching pattern" ) ;
167+ }
130168
131169 console . log ( "Build Success" ) ;
132170 process . chdir ( "../.." ) ;
0 commit comments