Skip to content

Commit

Permalink
fix: windows rebuild native
Browse files Browse the repository at this point in the history
  • Loading branch information
yantze committed Mar 6, 2022
1 parent 0a705af commit e5c5955
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 53 deletions.
42 changes: 4 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,11 @@ name: RELEASE
on:
push:
tags:
- 'v*'
- "v*"
workflow_dispatch:

jobs:
windows-build:
runs-on: windows-latest

strategy:
matrix:
node_version: [14.x]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Package Electron
run: |
npm i
npm run rebuild-native
npm run pack
env:
TARGET_PLATFORMS: win32


- uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: true
files: |
LICENSE
out/*.dmg
out/*.exe
macos-build:
build:
runs-on: macos-latest

strategy:
Expand All @@ -63,10 +30,9 @@ jobs:
env:
TARGET_PLATFORMS: darwin


- uses: 'marvinpinto/action-automatic-releases@latest'
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
files: |
LICENSE
Expand Down
2 changes: 1 addition & 1 deletion build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opensumi-desktop",
"version": "1.3.2",
"version": "1.3.3",
"main": "main/index.js",
"description": "OpenSumi Desktop",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion build/webpack.node.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
},
externals: [
function (context, request, callback) {
if (['node-pty', 'nsfw', 'spdlog', 'vscode-ripgrep', 'vm2', 'keytar'].indexOf(request) !== -1) {
if (['node-pty', 'nsfw', 'spdlog', 'vscode-ripgrep', 'vm2', 'keytar', 'vertx'].indexOf(request) !== -1) {
return callback(null, 'commonjs ' + request);
}
callback();
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ide-electron",
"version": "1.3.2",
"version": "1.3.3",
"description": "OpenSumi IDE Electron 示例项目",
"main": "./app/main/index.js",
"scripts": {
Expand Down Expand Up @@ -129,4 +129,4 @@
"webpack": "^4.46.0",
"webpack-cli": "^4.9.1"
}
}
}
33 changes: 22 additions & 11 deletions scripts/rebuild-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let commands;

const target = argv.target || 'node';
const arch = argv.arch || os.arch();
const platform = os.platform();
let version;

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

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

commands = [
`npm_config_arch=${arch}`,
`npm_config_target_arch=${arch}`,
os.platform() === 'win32'
? 'set HOME=~/.electron-gyp'
: 'HOME=~/.electron-gyp',

os.platform() === 'win32'
? join(__dirname, '..\\node_modules\\.bin\\electron-rebuild.cmd')
: join(__dirname, '../node_modules/.bin/electron-rebuild'),
];
if (platform === 'win32') {
commands = [
'node-gyp',
'rebuild',
'--openssl_fips=X',
`--target=${version}`,
`--arch=${arch}`,
'--dist-url=https://electronjs.org/headers',
]
} else {
commands = [
`npm_config_arch=${arch}`,
`npm_config_target_arch=${arch}`,
'node-gyp',
'rebuild',
'--openssl_fips=X',
`--target=${version}`,
`--arch=${arch}`,
'--dist-url=https://electronjs.org/headers',
];
}

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

Expand Down

0 comments on commit e5c5955

Please sign in to comment.