简体   繁体   中英

How is electron-updater able to find my repository?

I have a repository that utilizes electron-updater for auto update. The weird thing is, it has no any code whatsoever pointing where the release updates are stored (I store it in GitHub releases), but somehow the autoUpdater.checkForUpdatesAndNotify() still works. There is github remote origin but I doubt it's being used by electron-updater to find the repository. I don't use any GitHub token either.

The way I release update:

  • Increase the version in package.json
  • Run electron-builder , producing .AppImage
  • Create new release draft in my repository's GitHub releases
  • Upload the .AppImage file to the draft's assets and modify the draft's tag
  • Download the previous release, and then open it
  • Voila. The update works? But how?

It's worth mentioning that if latest-linux.yml is missing from the latest release's asset, it will throw 404 error and refuse to update despite knowing the latest version's tag.

Here's the repository I'm talking about: https://github.com/SnekNOTSnake/fresh-update/releases

Also, is this how normal people release their electron app? I tried the electron-builder --publish way, but it's troublesome compared to the manual steps above.

Thanks to Caramiriel in the comment section above for the enlightenment.

How electron-updater knows where to find the repository is from resources/app-update.yml inside the produced .AppImage file.

The app-update.yml file is produced by electron-builder using the information from git remote get-url origin (if available).

I proved it by changing the origin 's url to https://github.com/SnekNOTSnake/tofu-tracker.git and build the AppImage, and (surprisingly enough) the repo 's value became tofu-tracker .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM