Skip to content

Commit 54a87b3

Browse files
committed
update dependencies, combine steps, add windows-arm64 build
1 parent bc10a89 commit 54a87b3

File tree

3 files changed

+44
-73
lines changed

3 files changed

+44
-73
lines changed

.github/workflows/rebuildElectron.yml

Lines changed: 22 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,23 @@ jobs:
1717
run: echo ${{ github.ref }}
1818

1919
- name: Install Dependencies for Ubuntu
20-
# git >= 2.18 required for actions/checkout git support
2120
run: apt update && apt install -y software-properties-common git wget build-essential clang python3 libkrb5-dev libc++-dev zlib1g-dev libssl-dev
2221
env:
2322
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
2423

2524
- uses: actions/checkout@v4
2625

27-
- name: Use Node.js 20
26+
- name: Use Node.js 22
2827
uses: actions/setup-node@v4
2928
env:
3029
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
3130
with:
32-
node-version: 20
31+
node-version: 22
3332
architecture: ${{ matrix.arch }}
3433

3534
- run: git config --global --add safe.directory /__w/electron-npg-automator/electron-npg-automator
3635
- run: npm install
37-
- run: node ci/build.js
38-
env:
39-
electron_npg_automator_gh_token: ${{ secrets.electron_npg_automator_gh_token }}
40-
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
41-
AWS_ACCESS_KEY_ID: ${{ secrets.node_pre_gyp_accessKeyId }}
42-
AWS_SECRET_ACCESS_KEY: ${{ secrets.node_pre_gyp_secretAccessKey }}
43-
CC: clang
44-
CXX: clang++
45-
npm_config_clang: 1
46-
GYP_DEFINES: use_obsolete_asm=true
47-
BUILD_ONLY: true
48-
electron_npg_automator_module: nodegit/nodegit
49-
electron_npg_automator_use_git_clone: true
50-
- run: node ci/deploy.js
36+
- name: Build & Deploy
5137
env:
5238
electron_npg_automator_gh_token: ${{ secrets.electron_npg_automator_gh_token }}
5339
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
@@ -57,18 +43,20 @@ jobs:
5743
CXX: clang++
5844
npm_config_clang: 1
5945
GYP_DEFINES: use_obsolete_asm=true
60-
BUILD_ONLY: true
6146
electron_npg_automator_module: nodegit/nodegit
6247
electron_npg_automator_use_git_clone: true
48+
run: |
49+
node ci/prepare.js
50+
node ci/build.js
51+
node ci/deploy.js
6352
6453
rebuild-windows:
6554
name: Rebuild Windows
6655
strategy:
6756
matrix:
68-
os: [windows-2022]
69-
arch: [x64]
57+
arch: [x64, arm64]
7058
fail-fast: false
71-
runs-on: ${{ matrix.os }}
59+
runs-on: windows-latest
7260
steps:
7361
- name: Print Tag Ref
7462
run: echo ${{ github.ref }}
@@ -89,46 +77,39 @@ jobs:
8977
python-version: '3.11'
9078

9179
- run: npm install
92-
- run: node ci/build.js
80+
- name: Build & Deploy
9381
env:
9482
electron_npg_automator_gh_token: ${{ secrets.electron_npg_automator_gh_token }}
9583
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
9684
AWS_ACCESS_KEY_ID: ${{ secrets.node_pre_gyp_accessKeyId }}
9785
AWS_SECRET_ACCESS_KEY: ${{ secrets.node_pre_gyp_secretAccessKey }}
9886
GYP_DEFINES: use_obsolete_asm=true
99-
BUILD_ONLY: true
100-
electron_npg_automator_module: nodegit/nodegit
101-
electron_npg_automator_use_git_clone: true
102-
- run: node ci/deploy.js
103-
env:
104-
electron_npg_automator_gh_token: ${{ secrets.electron_npg_automator_gh_token }}
105-
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
106-
AWS_ACCESS_KEY_ID: ${{ secrets.node_pre_gyp_accessKeyId }}
107-
AWS_SECRET_ACCESS_KEY: ${{ secrets.node_pre_gyp_secretAccessKey }}
108-
GYP_DEFINES: use_obsolete_asm=true
109-
BUILD_ONLY: true
11087
electron_npg_automator_module: nodegit/nodegit
11188
electron_npg_automator_use_git_clone: true
89+
run: |
90+
node ci/prepare.js
91+
node ci/build.js
92+
node ci/deploy.js
11293
11394
rebuild-macos:
11495
name: Rebuild macOS
11596
strategy:
11697
matrix:
11798
arch: [x64, arm64]
11899
fail-fast: false
119-
runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }}
100+
runs-on: ${{ matrix.arch == 'x64' && 'macos-15-intel' || 'macos-15' }}
120101
steps:
121102
- name: Print Tag Ref
122103
run: echo ${{ github.ref }}
123104

124105
- uses: actions/checkout@v4
125106

126-
- name: Use Node.js 20
107+
- name: Use Node.js 22
127108
uses: actions/setup-node@v4
128109
env:
129110
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
130111
with:
131-
node-version: 20
112+
node-version: 22
132113
architecture: ${{ matrix.arch }}
133114

134115
- name: Use Python 3.11 # node-gyp < 10 breaks with 3.12
@@ -137,20 +118,7 @@ jobs:
137118
python-version: '3.11'
138119

139120
- run: npm install
140-
- run: node ci/build.js
141-
env:
142-
electron_npg_automator_gh_token: ${{ secrets.electron_npg_automator_gh_token }}
143-
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
144-
AWS_ACCESS_KEY_ID: ${{ secrets.node_pre_gyp_accessKeyId }}
145-
AWS_SECRET_ACCESS_KEY: ${{ secrets.node_pre_gyp_secretAccessKey }}
146-
CC: clang
147-
CXX: clang++
148-
npm_config_clang: 1
149-
GYP_DEFINES: use_obsolete_asm=true
150-
BUILD_ONLY: true
151-
electron_npg_automator_module: nodegit/nodegit
152-
electron_npg_automator_use_git_clone: true
153-
- run: node ci/deploy.js
121+
- name: Build & Deploy
154122
env:
155123
electron_npg_automator_gh_token: ${{ secrets.electron_npg_automator_gh_token }}
156124
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
@@ -160,6 +128,9 @@ jobs:
160128
CXX: clang++
161129
npm_config_clang: 1
162130
GYP_DEFINES: use_obsolete_asm=true
163-
BUILD_ONLY: true
164131
electron_npg_automator_module: nodegit/nodegit
165132
electron_npg_automator_use_git_clone: true
133+
run: |
134+
node ci/prepare.js
135+
node ci/build.js
136+
node ci/deploy.js

ci/build.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
11
const cp = require('child_process');
2-
const fs = require('fs');
2+
const getTagInfo = require('../util/get-tag-info');
3+
const modulePath = require('../util/module-path');
4+
const moduleParentPath = require('../util/module-parent-path');
35
const path = require('path');
6+
const {installNodeHeaders, rebuildNativeModules} = require('electron-rebuild');
47

5-
module.exports = function(electronVersion, moduleParentPath, modulePath) {
8+
function build (electronVersion, moduleParentPath, modulePath) {
69
return new Promise(function(resolve, reject) {
710
let npmrc = 'runtime = electron\n';
811
npmrc += 'disturl = https://electronjs.org/headers\n';
912
npmrc += `target = ${electronVersion.replace('v', '')}`;
13+
if (process.env.TARGET_ARCH) {
14+
npmrc += `\ntarget_arch = ${process.env.TARGET_ARCH}`;
15+
}
1016

1117
fs.writeFileSync(path.join(modulePath, '.npmrc'), npmrc);
1218

13-
if (process.platform === 'win32') {
14-
cp.exec(
15-
'npm install',
16-
{cwd: modulePath, maxBuffer: Number.MAX_VALUE},
17-
function(err, stdout, stderr) {
18-
console.log(stdout);
19-
console.error(stderr);
20-
if (err) {
21-
reject(err);
22-
}
23-
else {
24-
resolve();
25-
}
26-
}
27-
);
28-
return;
29-
}
30-
3119
const spawnedNPM = cp.spawn(
3220
'npm',
3321
['install'],
@@ -45,3 +33,15 @@ module.exports = function(electronVersion, moduleParentPath, modulePath) {
4533
})
4634
});
4735
};
36+
37+
getTagInfo()
38+
.then(({electronVersion}) => {
39+
electronVersion = electronVersion.replace('v', '');
40+
41+
return build(electronVersion, moduleParentPath(), modulePath());
42+
})
43+
.catch (e => {
44+
console.error('Error building:');
45+
console.error(e);
46+
process.exit(1);
47+
});

ci/prepare.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const modulePath = require('../util/module-path');
55
const do_prepare = () => new Promise((resolve, reject) => {
66
cp.exec(
77
'npm install',
8-
{cwd: _modulePath},
8+
{cwd: modulePath()},
99
(err, stdout, stderr) => {
1010
let out = err || {};
1111
out.stdout = stdout;
@@ -22,7 +22,7 @@ const do_prepare = () => new Promise((resolve, reject) => {
2222
downloadModule()
2323
.then(() => {
2424
console.log(`${new Date().toString()} preparing module`);
25-
return do_prepare(modulePath());
25+
return do_prepare();
2626
})
2727
.catch (e => {
2828
console.error('Error preparing to build:');

0 commit comments

Comments
 (0)