Skip to content

Commit 0f102c4

Browse files
authored
Use electron-builder beforeBuild (#164)
1 parent 32fca4b commit 0f102c4

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,10 @@ jobs:
5555
if [ "$RUNNER_OS" == "Windows" ]; then
5656
npx nx run open-lens:build:app --win nsis msi portable
5757
elif [ "$RUNNER_OS" == "Linux" ]; then
58-
npx nx run open-lens:build:app
59-
npm run all:reinstall
60-
npx nx reset
61-
6258
sudo apt update
63-
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
64-
export CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++
65-
mkdir -p open-lens/node_modules
59+
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
6660
67-
npx nx run open-lens:build:app --arm64
61+
npx nx run open-lens:build:app --x64 --arm64
6862
find . -name '*pty.node' -print0 | xargs -0 file
6963
else
7064
npx nx run open-lens:build:app --x64 --arm64

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.DS_Store
22
README.md
3+
/lens/

build-hooks/beforeBuild.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const archMap = {
2+
"amd64": "x86_64",
3+
"arm64": "aarch64",
4+
}
5+
6+
module.exports = async (buildContext) => {
7+
if (buildContext.platform.name !== "linux") return true
8+
9+
if (buildContext.arch in archMap) {
10+
process.env.CC = `${archMap[buildContext.arch]}-linux-gnu-gcc`
11+
process.env.CXX = `${archMap[buildContext.arch]}-linux-gnu-g++`
12+
} else {
13+
process.env.CC = "gcc"
14+
process.env.CXX = "g++"
15+
}
16+
return true
17+
}

update.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ packageJsonOpenLens.build.publish = [{
1010
packageJsonOpenLens.version = `${packageJsonOpenLens.version}-${process.env.BUILD_ID}`;
1111
packageJsonOpenLens.build.npmRebuild = true;
1212
packageJsonOpenLens.build.detectUpdateChannel = false;
13+
packageJsonOpenLens.build.beforeBuild = '../../build-hooks/beforeBuild';
1314

1415
delete packageJsonOpenLens.scripts.postinstall;
1516

0 commit comments

Comments
 (0)