带有私有 GitHub 存储库的电子自动更新器? [英] Electron Autoupdater with Private GitHub Repository?

查看:14
本文介绍了带有私有 GitHub 存储库的电子自动更新器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 PRIVATE GitHub Repository 作为提供者实现了 Electron AutoUpdater 来发布电子应用程序.现在,我可以使用 GitHub 存储库发布它,但是每当 AutoUpdater 尝试从 GitHub 存储库下载更新时,每次它都会提示响应代码 404 Not found.. 我尝试在 setFeedURL 方法中传递令牌并将其设置在 GH_TOKEN 但看起来像那样也不起作用.

I have implemented Electron AutoUpdater with PRIVATE GitHub Repository as provider to publish electron application. Now, i can publish it using GitHub repository but Whenever AutoUpdater tries to download the updates from GitHub repository, Everytime it prompts with response code 404 Not found.. I have tried passing token in setFeedURL method and also set it in GH_TOKEN but seems like that does not work either.

autoUpdater.setFeedURL({ provider: 'github'
, owner: 'owner'
, repo: 'repo-name'
, token: 'token'
, private: true });

那么,有没有办法让它与 PRIVATE GitHub Repository 一起使用?

So, Is there any way to get it working with PRIVATE GitHub Repository ?

推荐答案

你用的是 electron auto-updater 模块?从 API documentation,我可以看到他们不支持.

Are you using electron auto-updater module? from the API documentation, I can see that they don't support.

另一方面,如果您使用 electron-updater 模块,请制作确保您遵循推荐的发布工作流程,并且您不应该使用 setFeedURL 检查注释 这里

On the other hand, if you are using electron-updater module, make sure that you are following the recommended release workflow, and you should not use setFeedURL check the note here

更新:

如果您使用 electron-updater 并且您正在发布到私有存储库,您需要确保您的令牌在 app-update.yml 文件中可用,这就是为什么许多人说不建议这样做,如果您的 app- 中没有设置令牌update.yml 文件,你会得到 404.

If you are using electron-updater and you are publishing to a private repository, you will need to make sure that your token will be available within the app-update.yml file, that's why many say it's not recommended, if the token is not set in your app-update.yml file you will get 404.

对于 electron-updater 自动将您的令牌添加到 app-update.yml 文件中的令牌应在发布部分中设置,如下所示:

For electron-updater to auto add your token to the app-update.yml file the token should be set within the publish section like the following:

  "publish": [
    {
      "provider": "github",
      "private": true,
      "owner": "<github_owner>",
      "repo": "<repo_name>",
      "token": "<your github token>"
    }
  ],

这将生成一个 app-update.yml 文件,如下所示:

This will produce a app-update.yml file like the following:

owner: <github_owner>
repo: <repo_name>
provider: github
private: true
token: <your github token>
updaterCacheDirName: electron-updater-private-updater

查看这个小视频

这是我的代码 https://github.com/linuxjuggler/electron-auto-update-example 检查 electron-builder.json 文件.

Here is my code https://github.com/linuxjuggler/electron-auto-update-example check the electron-builder.json file.

更新 2

基于 快速设置指南部分中提到的注释,你永远不应该调用 setFeedURL.

Based on the note mentioned in the Quick Setup Guide section, you should never call setFeedURL.

这篇关于带有私有 GitHub 存储库的电子自动更新器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆