electron-builder 未在 Mac OS X 上发布到 GitHub
electron-builder Not Publishing to GitHub on Mac OS X
我有一个 Electron 应用程序需要使用 electron-builder
作为 Mac OS X 版本发布到 public GitHub 存储库。
问题: 由 运行
构建、签名和打包电子应用程序后
npm run release
该应用不会作为新版本自动发布到 GitHub 存储库。
如何设置electron-builder
自动上传电子版应用到Github?
版本
- 节点 12.6.0
electron
1.8.8
electron-builder
19.56.2
- Mac OS X 莫哈韦沙漠 10.14.5
npm run release
输出
> Foo-Bar@1.0.0 release /Users/nyxynyx/test/foo
> npm run package
> Foo-Bar@1.0.0 package /Users/nyxynyx/test/foo
> npm run build && electron-builder
> Foo-Bar@1.0.0 build /Users/nyxynyx/test/foo
> NODE_ENV=production webpack --config webpack.config.production.babel.js
Hash: 18da30a5e722cd0dcf18
Version: webpack 3.12.0
Time: 18196ms
Asset Size Chunks Chunk Names
95b0c26ef5d6681629df4139abdf25e2.png 40.8 kB [emitted]
e5624fc63eaf857505dcbca5f147cdab.jpg 84.9 kB [emitted]
daf19b8de627f3a50015fb522d61de2f.png 45.7 kB [emitted]
c01643f0abed8f9cdc07bd6f6d41430b.png 41.3 kB [emitted]
24f7b0944e9e03a905f9d7701573b2cd.woff2 14.9 kB [emitted]
a7622f60c56ddd5301549a786b54e6e6.woff 18.7 kB [emitted]
6725c3fb1f3abd7ebdcb2d244758f706.woff2 13.9 kB [emitted]
793b1237017aeacd646fb80911425566.woff 17.7 kB [emitted]
33543c5cc5d88f5695dd08c87d280dfd.woff2 14.4 kB [emitted]
de0869e324680c99efa1250515b4b41c.woff 18.1 kB [emitted]
b61a9055d92ac56c15cacf4271d4f072.woff2 13.8 kB [emitted]
06b4bfda4e139eaf3ab9872a6d66f42f.woff 17.4 kB [emitted]
819af3d3abdc9f135d49b80a91e2ff4c.woff2 14.9 kB [emitted]
449d681cd6006390e1bee3c3a660430b.woff 18.7 kB [emitted]
ebdfa24cb411ba3016abd1c3ea5746e5.woff2 13.9 kB [emitted]
56e5756b696615d6164a625e1bcb1a9e.woff 17.5 kB [emitted]
0edb76284a7a0f8db4665b560ee2b48f.woff2 15.1 kB [emitted]
1f85e92d8ff443980bc0f83ad7b23b60.woff 18.9 kB [emitted]
a49393f2171a2f4d6927ce6c14f73dbc.woff2 13.9 kB [emitted]
bf72679ca22e53320beaea090e8bb07d.woff 17.5 kB [emitted]
ab3e500e7375695d702cff19513e4470.woff2 15.1 kB [emitted]
05ebdbe10796850f045fcd484f35788d.woff 19.1 kB [emitted]
c62c3eea77cf3fca51494e8c924adf4d.woff2 14 kB [emitted]
92da6f116d973bd334cf9b3afdb29c4f.woff 17.8 kB [emitted]
bundle.js 2.13 MB 0 [emitted] [big] main
[147] (webpack)/buildin/harmony-module.js 596 bytes {0} [built]
[158] ./src/styles/theme.js 681 bytes {0} [built]
[265] ./src/index.js 1.16 kB {0} [built]
[333] ./src/styles/global.js 896 bytes {0} [built]
[337] ./src/store.js 2.13 kB {0} [built]
[339] ./src/reducers/index.js 729 bytes {0} [built]
...
+ 696 hidden modules
• electron-builder version=19.56.2
• loaded configuration file=package.json ("build" field)
• writing effective config file=release/electron-builder.yaml
• rebuilding native production dependencies platform=darwin arch=x64
• packaging platform=darwin arch=x64 electron=1.8.8 appOutDir=release/mac
• packaging platform=mas arch=x64 electron=1.8.8 appOutDir=release/mas
package.json
{
"name": "Foo-Bar",
"version": "1.0.0",
"description": "Foo-Bar",
"main": "main.js",
"scripts": {
"postinstall": "electron-builder install-app-deps",
"start": "NODE_ENV=development electron .",
"dev": "concurrently -k 'node -r babel-register server.js' 'npm start'",
"build": "NODE_ENV=production webpack --config webpack.config.production.babel.js",
"package": "npm run build && electron-builder",
"release": "npm run package"
},
"repository": {
"type" : "git",
"url" : "https://github.com/Foo/Bar.git"
},
"author": "Foo",
"engine-strict": true,
"engines": {
"node": ">= 6.x",
"npm": ">= 3.x"
},
"build": {
"appId": "com.foo.bar",
"productName": "Foo Bar",
"copyright": "Copyright © 2019 ${author}",
"directories": {
"output": "release"
},
"files": [
"dist/",
"resources/",
"index.html",
"main.js",
"package.json",
"embedded.provisionprofile"
],
"mac": {
"category": "public.app-category.utilities",
"icon": "resources/app.icns",
"entitlements": "build/entitlements.mac.plist",
"target": [
"pkg",
"dmg",
"zip",
"mas"
]
},
"mas": {
"type": "distribution",
"category": "public.app-category.utilities",
"icon": "resources/app.icns",
"entitlements": "build/entitlements.mas.plist"
},
"publish": [
"github"
]
},
"dependencies": {
...
},
"devDependencies": {
"electron": "^1.8.8",
"electron-builder": "^19.56.2",
"electron-debug": "^1.5.0",
"electron-devtools-installer": "^2.2.4",
"webpack": "^3.12.0",
"webpack-dev-middleware": "^2.0.6",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.1",
...
},
"optionalDependencies": {
"jquery": "^3.4.1"
}
}
当你 运行 npm run release
时,它只是 运行 npm run build && electron-builder
。所以它只会打包你的应用程序而不是发布它。您需要在 package
脚本中添加 --publish=always
才能发布您的应用程序
"package": "npm run build && electron-builder --publish=always",
并将 package.json
中的 publish
编辑成这样
"publish": [
{
"provider": "github",
"owner": "incognitochain",
"repo": "incognito-monitor"
}
]
我有一个 Electron 应用程序需要使用 electron-builder
作为 Mac OS X 版本发布到 public GitHub 存储库。
问题: 由 运行
构建、签名和打包电子应用程序后npm run release
该应用不会作为新版本自动发布到 GitHub 存储库。
如何设置electron-builder
自动上传电子版应用到Github?
版本
- 节点 12.6.0
electron
1.8.8electron-builder
19.56.2- Mac OS X 莫哈韦沙漠 10.14.5
npm run release
输出
> Foo-Bar@1.0.0 release /Users/nyxynyx/test/foo
> npm run package
> Foo-Bar@1.0.0 package /Users/nyxynyx/test/foo
> npm run build && electron-builder
> Foo-Bar@1.0.0 build /Users/nyxynyx/test/foo
> NODE_ENV=production webpack --config webpack.config.production.babel.js
Hash: 18da30a5e722cd0dcf18
Version: webpack 3.12.0
Time: 18196ms
Asset Size Chunks Chunk Names
95b0c26ef5d6681629df4139abdf25e2.png 40.8 kB [emitted]
e5624fc63eaf857505dcbca5f147cdab.jpg 84.9 kB [emitted]
daf19b8de627f3a50015fb522d61de2f.png 45.7 kB [emitted]
c01643f0abed8f9cdc07bd6f6d41430b.png 41.3 kB [emitted]
24f7b0944e9e03a905f9d7701573b2cd.woff2 14.9 kB [emitted]
a7622f60c56ddd5301549a786b54e6e6.woff 18.7 kB [emitted]
6725c3fb1f3abd7ebdcb2d244758f706.woff2 13.9 kB [emitted]
793b1237017aeacd646fb80911425566.woff 17.7 kB [emitted]
33543c5cc5d88f5695dd08c87d280dfd.woff2 14.4 kB [emitted]
de0869e324680c99efa1250515b4b41c.woff 18.1 kB [emitted]
b61a9055d92ac56c15cacf4271d4f072.woff2 13.8 kB [emitted]
06b4bfda4e139eaf3ab9872a6d66f42f.woff 17.4 kB [emitted]
819af3d3abdc9f135d49b80a91e2ff4c.woff2 14.9 kB [emitted]
449d681cd6006390e1bee3c3a660430b.woff 18.7 kB [emitted]
ebdfa24cb411ba3016abd1c3ea5746e5.woff2 13.9 kB [emitted]
56e5756b696615d6164a625e1bcb1a9e.woff 17.5 kB [emitted]
0edb76284a7a0f8db4665b560ee2b48f.woff2 15.1 kB [emitted]
1f85e92d8ff443980bc0f83ad7b23b60.woff 18.9 kB [emitted]
a49393f2171a2f4d6927ce6c14f73dbc.woff2 13.9 kB [emitted]
bf72679ca22e53320beaea090e8bb07d.woff 17.5 kB [emitted]
ab3e500e7375695d702cff19513e4470.woff2 15.1 kB [emitted]
05ebdbe10796850f045fcd484f35788d.woff 19.1 kB [emitted]
c62c3eea77cf3fca51494e8c924adf4d.woff2 14 kB [emitted]
92da6f116d973bd334cf9b3afdb29c4f.woff 17.8 kB [emitted]
bundle.js 2.13 MB 0 [emitted] [big] main
[147] (webpack)/buildin/harmony-module.js 596 bytes {0} [built]
[158] ./src/styles/theme.js 681 bytes {0} [built]
[265] ./src/index.js 1.16 kB {0} [built]
[333] ./src/styles/global.js 896 bytes {0} [built]
[337] ./src/store.js 2.13 kB {0} [built]
[339] ./src/reducers/index.js 729 bytes {0} [built]
...
+ 696 hidden modules
• electron-builder version=19.56.2
• loaded configuration file=package.json ("build" field)
• writing effective config file=release/electron-builder.yaml
• rebuilding native production dependencies platform=darwin arch=x64
• packaging platform=darwin arch=x64 electron=1.8.8 appOutDir=release/mac
• packaging platform=mas arch=x64 electron=1.8.8 appOutDir=release/mas
package.json
{
"name": "Foo-Bar",
"version": "1.0.0",
"description": "Foo-Bar",
"main": "main.js",
"scripts": {
"postinstall": "electron-builder install-app-deps",
"start": "NODE_ENV=development electron .",
"dev": "concurrently -k 'node -r babel-register server.js' 'npm start'",
"build": "NODE_ENV=production webpack --config webpack.config.production.babel.js",
"package": "npm run build && electron-builder",
"release": "npm run package"
},
"repository": {
"type" : "git",
"url" : "https://github.com/Foo/Bar.git"
},
"author": "Foo",
"engine-strict": true,
"engines": {
"node": ">= 6.x",
"npm": ">= 3.x"
},
"build": {
"appId": "com.foo.bar",
"productName": "Foo Bar",
"copyright": "Copyright © 2019 ${author}",
"directories": {
"output": "release"
},
"files": [
"dist/",
"resources/",
"index.html",
"main.js",
"package.json",
"embedded.provisionprofile"
],
"mac": {
"category": "public.app-category.utilities",
"icon": "resources/app.icns",
"entitlements": "build/entitlements.mac.plist",
"target": [
"pkg",
"dmg",
"zip",
"mas"
]
},
"mas": {
"type": "distribution",
"category": "public.app-category.utilities",
"icon": "resources/app.icns",
"entitlements": "build/entitlements.mas.plist"
},
"publish": [
"github"
]
},
"dependencies": {
...
},
"devDependencies": {
"electron": "^1.8.8",
"electron-builder": "^19.56.2",
"electron-debug": "^1.5.0",
"electron-devtools-installer": "^2.2.4",
"webpack": "^3.12.0",
"webpack-dev-middleware": "^2.0.6",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.1",
...
},
"optionalDependencies": {
"jquery": "^3.4.1"
}
}
当你 运行 npm run release
时,它只是 运行 npm run build && electron-builder
。所以它只会打包你的应用程序而不是发布它。您需要在 package
脚本中添加 --publish=always
才能发布您的应用程序
"package": "npm run build && electron-builder --publish=always",
并将 package.json
中的 publish
编辑成这样
"publish": [
{
"provider": "github",
"owner": "incognitochain",
"repo": "incognito-monitor"
}
]