Skip to content

Commit de7c3f6

Browse files
committed
chore: try fixing electron install
1 parent 7b4d3e2 commit de7c3f6

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

.github/workflows/tests.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@ jobs:
6868
fi
6969
npm install
7070
if [ ! -f node_modules/electron/path.txt ]; then
71-
cd node_modules/electron && node -e "(async () => {
72-
const fs = require('fs');
73-
const path = require('path');
74-
const { version } = require('./package.json');
75-
const platformPath = process.platform === 'darwin' ? 'Electron.app/Contents/MacOS/Electron' : process.platform === 'win32' ? 'electron.exe' : 'electron';
71+
ZIPPATH=$(cd node_modules/electron && node -e "(async () => {
7672
const { downloadArtifact } = await import('@electron/get');
77-
const extract = require('extract-zip');
78-
console.log('Downloading electron@' + version + ' for ' + process.platform + '-' + process.arch);
73+
const { version } = require('./package.json');
7974
const zipPath = await downloadArtifact({ version, artifactName: 'electron', platform: process.platform, arch: process.arch });
80-
console.log('Downloaded to ' + zipPath + ', extracting...');
81-
await extract(zipPath, { dir: path.join(process.cwd(), 'dist') });
82-
await fs.promises.writeFile('path.txt', platformPath);
83-
console.log('Wrote path.txt = ' + platformPath);
84-
})().catch(e => { console.error(e); process.exit(1); });" && cd -
75+
process.stdout.write(zipPath);
76+
})().catch(e => { console.error(e); process.exit(1); });")
77+
echo "Downloaded $ZIPPATH, extracting via system unzip..."
78+
mkdir -p node_modules/electron/dist
79+
unzip -q -o "$ZIPPATH" -d node_modules/electron/dist
80+
case "$RUNNER_OS" in
81+
Linux) echo electron > node_modules/electron/path.txt ;;
82+
macOS) echo "Electron.app/Contents/MacOS/Electron" > node_modules/electron/path.txt ;;
83+
Windows) echo electron.exe > node_modules/electron/path.txt ;;
84+
esac
8585
fi
8686
test -f node_modules/electron/path.txt || { echo "ERROR: path.txt missing"; ls -la node_modules/electron/; exit 1; }
8787

0 commit comments

Comments
 (0)