Electron Autoupdater with Private GitHub Repository?

旧城冷巷雨未停 提交于 2019-12-23 04:43:52

问题


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 });

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


回答1:


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

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

Updated:

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.

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>"
    }
  ],

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

Check this small video

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

Update 2

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




回答2:


Auto-Update - you can see that private github repos works only for very special cases, and they are recommending to have a separate release-only repository to distribute releases so source is locked down, and you can distribute to controlled machines. It is a useful feature since no server is required, but special use case. Also, you can make this work with s3 bucket or some other upgrade servers.



来源:https://stackoverflow.com/questions/57069210/electron-autoupdater-with-private-github-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!