Skip to content

Commit 162c5f4

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

File tree

3 files changed

+45
-74
lines changed

3 files changed

+45
-74
lines changed

.github/workflows/rebuildElectron.yml

Lines changed: 22 additions & 52 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 }}
@@ -81,54 +69,46 @@ jobs:
8169
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
8270
with:
8371
node-version: 22
84-
architecture: ${{ matrix.arch }}
8572

8673
- name: Use Python 3.11 # node-gyp < 10 breaks with 3.12
8774
uses: actions/setup-python@v4
8875
with:
8976
python-version: '3.11'
9077

9178
- run: npm install
92-
- run: node ci/build.js
93-
env:
94-
electron_npg_automator_gh_token: ${{ secrets.electron_npg_automator_gh_token }}
95-
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
96-
AWS_ACCESS_KEY_ID: ${{ secrets.node_pre_gyp_accessKeyId }}
97-
AWS_SECRET_ACCESS_KEY: ${{ secrets.node_pre_gyp_secretAccessKey }}
98-
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
79+
- name: Build & Deploy
10380
env:
10481
electron_npg_automator_gh_token: ${{ secrets.electron_npg_automator_gh_token }}
10582
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
10683
AWS_ACCESS_KEY_ID: ${{ secrets.node_pre_gyp_accessKeyId }}
10784
AWS_SECRET_ACCESS_KEY: ${{ secrets.node_pre_gyp_secretAccessKey }}
10885
GYP_DEFINES: use_obsolete_asm=true
109-
BUILD_ONLY: true
11086
electron_npg_automator_module: nodegit/nodegit
11187
electron_npg_automator_use_git_clone: true
88+
run: |
89+
node ci/prepare.js
90+
node ci/build.js
91+
node ci/deploy.js
11292
11393
rebuild-macos:
11494
name: Rebuild macOS
11595
strategy:
11696
matrix:
11797
arch: [x64, arm64]
11898
fail-fast: false
119-
runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }}
99+
runs-on: ${{ matrix.arch == 'x64' && 'macos-15-intel' || 'macos-15' }}
120100
steps:
121101
- name: Print Tag Ref
122102
run: echo ${{ github.ref }}
123103

124104
- uses: actions/checkout@v4
125105

126-
- name: Use Node.js 20
106+
- name: Use Node.js 22
127107
uses: actions/setup-node@v4
128108
env:
129109
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
130110
with:
131-
node-version: 20
111+
node-version: 22
132112
architecture: ${{ matrix.arch }}
133113

134114
- name: Use Python 3.11 # node-gyp < 10 breaks with 3.12
@@ -137,20 +117,7 @@ jobs:
137117
python-version: '3.11'
138118

139119
- 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
120+
- name: Build & Deploy
154121
env:
155122
electron_npg_automator_gh_token: ${{ secrets.electron_npg_automator_gh_token }}
156123
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
@@ -160,6 +127,9 @@ jobs:
160127
CXX: clang++
161128
npm_config_clang: 1
162129
GYP_DEFINES: use_obsolete_asm=true
163-
BUILD_ONLY: true
164130
electron_npg_automator_module: nodegit/nodegit
165131
electron_npg_automator_use_git_clone: true
132+
run: |
133+
node ci/prepare.js
134+
node ci/build.js
135+
node ci/deploy.js

ci/build.js

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

5-
module.exports = function(electronVersion, moduleParentPath, modulePath) {
9+
function build (electronVersion, moduleParentPath, modulePath) {
610
return new Promise(function(resolve, reject) {
711
let npmrc = 'runtime = electron\n';
812
npmrc += 'disturl = https://electronjs.org/headers\n';
913
npmrc += `target = ${electronVersion.replace('v', '')}`;
14+
if (process.env.TARGET_ARCH) {
15+
npmrc += `\ntarget_arch = ${process.env.TARGET_ARCH}`;
16+
}
1017

1118
fs.writeFileSync(path.join(modulePath, '.npmrc'), npmrc);
1219

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-
3120
const spawnedNPM = cp.spawn(
3221
'npm',
3322
['install'],
@@ -45,3 +34,15 @@ module.exports = function(electronVersion, moduleParentPath, modulePath) {
4534
})
4635
});
4736
};
37+
38+
getTagInfo()
39+
.then(({electronVersion}) => {
40+
electronVersion = electronVersion.replace('v', '');
41+
42+
return build(electronVersion, moduleParentPath(), modulePath());
43+
})
44+
.catch (e => {
45+
console.error('Error building:');
46+
console.error(e);
47+
process.exit(1);
48+
});

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)