Skip to content

Commit

Permalink
Use electron-builder beforeBuild (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroepke authored Jun 30, 2023
1 parent 32fca4b commit 0f102c4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,10 @@ jobs:
if [ "$RUNNER_OS" == "Windows" ]; then
npx nx run open-lens:build:app --win nsis msi portable
elif [ "$RUNNER_OS" == "Linux" ]; then
npx nx run open-lens:build:app
npm run all:reinstall
npx nx reset
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
export CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++
mkdir -p open-lens/node_modules
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
npx nx run open-lens:build:app --arm64
npx nx run open-lens:build:app --x64 --arm64
find . -name '*pty.node' -print0 | xargs -0 file
else
npx nx run open-lens:build:app --x64 --arm64
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
README.md
/lens/
17 changes: 17 additions & 0 deletions build-hooks/beforeBuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const archMap = {
"amd64": "x86_64",
"arm64": "aarch64",
}

module.exports = async (buildContext) => {
if (buildContext.platform.name !== "linux") return true

if (buildContext.arch in archMap) {
process.env.CC = `${archMap[buildContext.arch]}-linux-gnu-gcc`
process.env.CXX = `${archMap[buildContext.arch]}-linux-gnu-g++`
} else {
process.env.CC = "gcc"
process.env.CXX = "g++"
}
return true
}
1 change: 1 addition & 0 deletions update.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ packageJsonOpenLens.build.publish = [{
packageJsonOpenLens.version = `${packageJsonOpenLens.version}-${process.env.BUILD_ID}`;
packageJsonOpenLens.build.npmRebuild = true;
packageJsonOpenLens.build.detectUpdateChannel = false;
packageJsonOpenLens.build.beforeBuild = '../../build-hooks/beforeBuild';

delete packageJsonOpenLens.scripts.postinstall;

Expand Down

0 comments on commit 0f102c4

Please sign in to comment.