gpt4 book ai didi

javascript - Electron-builder 未在 Mac OS X 上发布到 GitHub

转载 作者:行者123 更新时间:2023-12-01 00:45:43 26 4
gpt4 key购买 nike

我有一个 Electron 应用程序,需要使用 electron-builder 将其作为 Mac OS X 版本发布到公共(public) GitHub 存储库。

问题:通过运行构建、签名和打包 Electron 应用程序后

npm run release

应用程序不会作为新版本自动发布到 GitHub 存储库。

我们如何设置 electron-builder 自动将 Electron 应用版本上传到 Github?

版本

  • Node 12.6.0
  • Electron 1.8.8
  • Electron 构建器 19.56.2
  • Mac OS X Mojave 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 && electro-builder。所以它只会打包你的应用程序而不发布它。您需要在 package 脚本中添加 --publish=always 来发布您的应用

"package": "npm run build && electron-builder --publish=always",

并将 package.json 中的 publish 编辑为如下内容

"publish": [
{
"provider": "github",
"owner": "incognitochain",
"repo": "incognito-monitor"
}
]

关于javascript - Electron-builder 未在 Mac OS X 上发布到 GitHub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57387371/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com