Skip to content

Commit fcd7c02

Browse files
committed
feat: remove auto release
1 parent b01df97 commit fcd7c02

File tree

2 files changed

+20
-110
lines changed

2 files changed

+20
-110
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,23 @@ 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
10+
release:
11+
name: Publish for ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
1213

1314
strategy:
1415
matrix:
1516
node_version: [14.x]
17+
include:
18+
- os: windows-latest
19+
TARGET_PLATFORMS: win32
1620

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:
44-
runs-on: macos-latest
45-
46-
strategy:
47-
matrix:
48-
node_version: [14.x]
21+
- os: macos-latest
22+
TARGET_PLATFORMS: darwin
4923

5024
steps:
5125
- uses: actions/checkout@v2
@@ -60,13 +34,10 @@ jobs:
6034
npm i
6135
npm run rebuild-native
6236
npm run pack
63-
env:
64-
TARGET_PLATFORMS: darwin
65-
6637
67-
- uses: 'marvinpinto/action-automatic-releases@latest'
38+
- uses: "marvinpinto/action-automatic-releases@latest"
6839
with:
69-
repo_token: '${{ secrets.GITHUB_TOKEN }}'
40+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
7041
prerelease: true
7142
files: |
7243
LICENSE

scripts/rebuild-native.js

Lines changed: 9 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,15 @@
1-
const os = require('os');
2-
const { join } = require('path');
3-
const { execSync } = require('child_process');
4-
const { pathExistsSync, copySync, removeSync } = require('fs-extra');
1+
const path = require('path');
52
const argv = require('yargs').argv;
3+
const electronRebuild = require('electron-rebuild');
64

7-
const nativeModules = [
8-
join(__dirname, '../node_modules/node-pty'),
9-
join(__dirname, '../node_modules/nsfw'),
10-
join(__dirname, '../node_modules/spdlog')
11-
]
5+
const electronVersion = argv.electronVersion || require('electron/package.json').version;
126

13-
let commands;
7+
console.log('rebuilding native for electron version ' + electronVersion);
8+
const force = argv['force-rebuild'] === 'true';
9+
const buildPath = path.resolve(__dirname, '..');
1410

15-
const target = argv.target || 'node';
16-
const arch = argv.arch || os.arch();
17-
let version;
18-
19-
if (target === 'electron') {
20-
21-
version = argv.electronVersion || require('electron/package.json').version;
22-
23-
console.log('rebuilding native for electron version ' + version);
24-
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-
];
36-
37-
} else if (target === 'node') {
38-
39-
console.log('rebuilding native for node version ' + process.version);
40-
41-
version = process.version;
42-
43-
commands = ['node-gyp', 'rebuild']
44-
45-
}
46-
47-
function rebuildModule(modulePath, type, version) {
48-
const info = require(join(modulePath, './package.json'));
49-
console.log('rebuilding ' + info.name)
50-
const cache = getBuildCacheDir(modulePath, type, version, target);
51-
if (pathExistsSync(cache) && !argv['force-rebuild']) {
52-
console.log('cache found for ' + info.name)
53-
copySync(cache, join(modulePath, 'build'));
54-
}
55-
else {
56-
const command = commands.join(' ');
57-
console.log(command);
58-
execSync(command, {
59-
cwd: modulePath,
60-
HOME: target === 'electron' ? '~/.electron-gyp' : undefined
61-
});
62-
removeSync(cache);
63-
copySync(join(modulePath, 'build'), cache);
64-
}
65-
66-
}
67-
68-
function getBuildCacheDir(modulePath, type, version, target) {
69-
const info = require(join(modulePath, './package.json'));
70-
return join(require('os').tmpdir(), 'ide_build_cache', target, info.name + '-' + info.version, type + '-' + version);
11+
if (force) {
12+
console.log('Force rebuild flag enabled.');
7113
}
7214

73-
74-
nativeModules.forEach(path => {
75-
rebuildModule(path, target, version);
76-
})
15+
electronRebuild.rebuild({ buildPath, electronVersion, force })

0 commit comments

Comments
 (0)