我想使用 electron-builder 的 autoUpdater 来更新我的应用程序。我没有使用 Github Releases,因为我有一个私人仓库并且出于安全目的不想包含 GH_TOKEN。相反,我想将二进制文件和 latest.yml/latest-mac.yml 文件放入 Google 存储桶中。
我知道可以使用通用提供程序来检查更新。但是目前,我什至无法让 electron-builder 阅读 latest.yml。我已经倾注了数小时和数小时的文档和其他 github/stack 溢出问题,但没有找到任何解决此问题的方法。
这是我在main.js
电子/自动更新程序中设置新提要 URL 的代码 -
const data = {
provider: 'generic',
url: 'https://storage.cloud.google.com/my-project', //'my-project' is the name of the bucket
channel: 'latest',
};
autoUpdater.setFeedURL(data);
autoUpdater.autoDownload = false;
autoUpdater.checkForUpdates();
构建的应用程序和 yml 文件都在该存储桶中。当我尝试运行我的应用程序时,我收到一个巨大的错误,基本上只是复制了 Google Cloud Storage HTML/CSS,而不是读取和处理 latest.yml 文件......
Error: Error: Cannot parse update info from latest-mac.yml in the latest release artifacts (https://storage.cloud.google.com/my-project/latest-mac.yml?noCache=1dh4pdr5e): YAMLException: end of the stream or a document separator is expected at line 11, column 14:
font-family: 'Open Sans';
^
at generateError (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
at throwError (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
at readDocument (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1539:5)
at loadDocuments (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1575:5)
at load (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1596:19)
at safeLoad (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1618:10)
at parseUpdateInfo (/Users/somelocation/documents/some-project/node_modules/electron-updater/out/providers/Provider.js:131:37)
at GenericProvider.getLatestVersion (/Users/somelocation/documents/some-project/node_modules/electron-updater/out/providers/GenericProvider.js:57:48)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
at async MacUpdater.getUpdateInfoAndProvider (/Users/somelocation/documents/some-project/node_modules/electron-updater/out/AppUpdater.js:488:13), rawData:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=300, initial-scale=1" name="viewport">
<meta name="google-site-verification" content="LrdTUW9psUAMbh4Ia074-BPEVmcpBxF6Gwf0MSgQXZs">
<title>Sign in - Google Accounts</title>
是否可以从 Google Cloud Storage 存储桶而不是 S3 或 Github 读取文件?另外,我已经尝试从 yml 文件中删除多余的行或制表符。