Skip to content

Commit e5c5955

Browse files
committed
fix: windows rebuild native
1 parent 0a705af commit e5c5955

File tree

5 files changed

+30
-53
lines changed

5 files changed

+30
-53
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,11 @@ name: RELEASE
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
77
workflow_dispatch:
88

99
jobs:
10-
windows-build:
11-
runs-on: windows-latest
12-
13-
strategy:
14-
matrix:
15-
node_version: [14.x]
16-
17-
steps:
18-
- uses: actions/checkout@v2
19-
20-
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v1
22-
with:
23-
node-version: ${{ matrix.node-version }}
24-
25-
- name: Package Electron
26-
run: |
27-
npm i
28-
npm run rebuild-native
29-
npm run pack
30-
env:
31-
TARGET_PLATFORMS: win32
32-
33-
34-
- uses: 'marvinpinto/action-automatic-releases@latest'
35-
with:
36-
repo_token: '${{ secrets.GITHUB_TOKEN }}'
37-
prerelease: true
38-
files: |
39-
LICENSE
40-
out/*.dmg
41-
out/*.exe
42-
43-
macos-build:
10+
build:
4411
runs-on: macos-latest
4512

4613
strategy:
@@ -63,10 +30,9 @@ jobs:
6330
env:
6431
TARGET_PLATFORMS: darwin
6532

66-
67-
- uses: 'marvinpinto/action-automatic-releases@latest'
33+
- uses: "marvinpinto/action-automatic-releases@latest"
6834
with:
69-
repo_token: '${{ secrets.GITHUB_TOKEN }}'
35+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
7036
prerelease: true
7137
files: |
7238
LICENSE

build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opensumi-desktop",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"main": "main/index.js",
55
"description": "OpenSumi Desktop",
66
"private": true,

build/webpack.node.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = {
4343
},
4444
externals: [
4545
function (context, request, callback) {
46-
if (['node-pty', 'nsfw', 'spdlog', 'vscode-ripgrep', 'vm2', 'keytar'].indexOf(request) !== -1) {
46+
if (['node-pty', 'nsfw', 'spdlog', 'vscode-ripgrep', 'vm2', 'keytar', 'vertx'].indexOf(request) !== -1) {
4747
return callback(null, 'commonjs ' + request);
4848
}
4949
callback();

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ide-electron",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"description": "OpenSumi IDE Electron 示例项目",
55
"main": "./app/main/index.js",
66
"scripts": {
@@ -129,4 +129,4 @@
129129
"webpack": "^4.46.0",
130130
"webpack-cli": "^4.9.1"
131131
}
132-
}
132+
}

scripts/rebuild-native.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ let commands;
1414

1515
const target = argv.target || 'node';
1616
const arch = argv.arch || os.arch();
17+
const platform = os.platform();
1718
let version;
1819

1920
if (target === 'electron') {
@@ -22,17 +23,27 @@ if (target === 'electron') {
2223

2324
console.log('rebuilding native for electron version ' + version);
2425

25-
commands = [
26-
`npm_config_arch=${arch}`,
27-
`npm_config_target_arch=${arch}`,
28-
os.platform() === 'win32'
29-
? 'set HOME=~/.electron-gyp'
30-
: 'HOME=~/.electron-gyp',
31-
32-
os.platform() === 'win32'
33-
? join(__dirname, '..\\node_modules\\.bin\\electron-rebuild.cmd')
34-
: join(__dirname, '../node_modules/.bin/electron-rebuild'),
35-
];
26+
if (platform === 'win32') {
27+
commands = [
28+
'node-gyp',
29+
'rebuild',
30+
'--openssl_fips=X',
31+
`--target=${version}`,
32+
`--arch=${arch}`,
33+
'--dist-url=https://electronjs.org/headers',
34+
]
35+
} else {
36+
commands = [
37+
`npm_config_arch=${arch}`,
38+
`npm_config_target_arch=${arch}`,
39+
'node-gyp',
40+
'rebuild',
41+
'--openssl_fips=X',
42+
`--target=${version}`,
43+
`--arch=${arch}`,
44+
'--dist-url=https://electronjs.org/headers',
45+
];
46+
}
3647

3748
} else if (target === 'node') {
3849

0 commit comments

Comments
 (0)