SabakiHQ / Sabaki

An elegant Go board and SGF editor for a more civilized age.
https://sabaki.yichuanshen.de/
MIT License
2.41k stars 377 forks source link

Implementing the auto updater #364

Open ohyou opened 6 years ago

ohyou commented 6 years ago

Discussion.

I've been poking around the electron-updater (npm package) and it seems to be working, except the workflow needs to be modified to account for it.

The usage is basically:

const {autoUpdater} = require("electron-updater")
autoUpdater.checkForUpdatesAndNotify()

In place of the currently existing updater.check(). But it requires the "publish" (electron-builder workflow feature) to be configured in a way that would allow electron-builder to publish drafts to the Github Releases.

I could not test that out, because in the current repository there appears to be no scripts that would perform the publish, leaving me clueless of how it's done and of what exactly needs to be adjusted.

Open question:

Guide to configuring the electron-updater: https://www.electron.build/auto-update
Guide to configuring "publish": https://www.electron.build/configuration/publish

yishn commented 6 years ago

Thank you for investigating! Currently, as you noticed, there are no scripts that perform the publish; I'm doing everything manually. I'm building the Windows version locally, then the macOS and Linux versions in a corresponding VM (because you can't build the macOS version on Windows, and I can test them immediately).

What exactly is the publish script of electron-builder doing? How would the workflow change?

ohyou commented 6 years ago

The "publish" pushes artifacts to the latest draft in Github Releases of the corresponding repository, and it also automatically builds the meta files for "autoUpdater". The last bit is important for all of this to work.
If you're doing everything manual then I think nothing would change, aside from the way you upload artifacts.

Personally I haven't ever done this via Github Releases. I used electron-updater for our projects at work, but we had an update server up and running, so the entire thing was literally 3 lines of code (ones above + setting a custom feed url). So I might be slightly wrong as I don't know the nuances of doing this via Github Releases.