@@ -27,8 +27,6 @@ const getPlatform = () => {
2727 switch ( process . platform ) {
2828 case "darwin" :
2929 return "mac" ;
30- case "win32" :
31- return "windows" ;
3230 default :
3331 return "linux" ;
3432 }
@@ -72,7 +70,6 @@ const runAction = () => {
7270 const useVueCli = getInput ( "use_vue_cli" ) === "true" ;
7371 const args = getInput ( "args" ) || "" ;
7472 const maxAttempts = Number ( getInput ( "max_attempts" ) || "1" ) ;
75- const skipWindowsNpmInstall = getInput ( "skip_windows_npm_install" ) === "true" ;
7673
7774 // TODO: Deprecated option, remove in v2.0. `electron-builder` always requires a `package.json` in
7875 // the same directory as the Electron app, so the `package_root` option should be used instead
@@ -114,28 +111,40 @@ const runAction = () => {
114111 }
115112
116113 // Run NPM build script if it exists
117- if ( skipBuild ) {
118- log ( "Skipping build script because `skip_build` option is set" ) ;
114+ log ( "Running the build script…" ) ;
115+ if ( useNpm ) {
116+ run ( `npm run ${ buildScriptName } --if-present` , pkgRoot ) ;
119117 } else {
120- log ( "Running the build script…" ) ;
121- if ( useNpm ) {
122- run ( `npm run ${ buildScriptName } --if-present` , pkgRoot ) ;
123- } else {
124- // TODO: Use `yarn run ${buildScriptName} --if-present` once supported
125- // https://github.com/yarnpkg/yarn/issues/6894
126- const pkgJson = JSON . parse ( readFileSync ( pkgJsonPath , "utf8" ) ) ;
127- if ( pkgJson . scripts && pkgJson . scripts [ buildScriptName ] ) {
128- run ( `yarn run ${ buildScriptName } ` , pkgRoot ) ;
129- }
118+ // TODO: Use `yarn run ${buildScriptName} --if-present` once supported
119+ // https://github.com/yarnpkg/yarn/issues/6894
120+ const pkgJson = JSON . parse ( readFileSync ( pkgJsonPath , "utf8" ) ) ;
121+ if ( pkgJson . scripts && pkgJson . scripts [ buildScriptName ] ) {
122+ run ( `yarn run ${ buildScriptName } ` , pkgRoot ) ;
130123 }
131124 }
132125
126+ if ( platform === "linux" ) {
127+ log ( "Installing wine to build Windows app on Linux…" ) ;
128+ run ( "sudo dpkg --add-architecture i386" )
129+ run ( "sudo apt-get update" )
130+ run ( "sudo apt-get install -y software-properties-common" )
131+ run ( "sudo add-apt-repository -y ppa:cybermax-dexter/sdl2-backport" )
132+ run ( "sudo apt-get update" )
133+ run ( `sudo apt-get install -y \
134+ wine32 \
135+ winbind \
136+ xvfb` )
137+ // Verify Wine installation
138+ log ( "Verifying Wine installation…" ) ;
139+ run ( "wine --version" )
140+ }
141+
133142 log ( `Building${ release ? " and releasing" : "" } the Electron app…` ) ;
134143 const cmd = useVueCli ? "vue-cli-service electron:build" : "electron-builder" ;
135144 for ( let i = 0 ; i < maxAttempts ; i += 1 ) {
136145 try {
137146 run (
138- `${ useNpm ? "npx --no-install" : "yarn run" } ${ cmd } -- ${ platform } ${
147+ `${ useNpm ? "npx --no-install" : "yarn run" } ${ cmd } -${ platform === "mac" ? "m" : "wl" } ${
139148 release ? "--publish always" : ""
140149 } ${ args } `,
141150 appRoot ,
0 commit comments