Open leaanthony opened 2 years ago
I think this feature can exist as an official library under the wailsapp organization, and developers can choose to use it or not, and should not be built into the wails project.
This way developers can customize their auto-update strategy and we can provide guidance and examples.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Vital feedback on this feature: https://gophers.slack.com/archives/CJ4P9F7MZ/p1656654913191629?thread_ts=1656616142.685839&cid=CJ4P9F7MZ
I am very interested by this but does not have access to the slack post in question. Has anyone tested rhysd/go-github-selfupdate with wails ?
I'm using it with wails for some time. Work smoothly. Implemented like that:
func CheckForUpdate(currentVersion string) (bool, string, string) {
latest, found, err := selfupdate.DetectLatest("annikovk/IntelliJ-Log-Analyzer")
if err != nil {
log.Println("Error occurred while detecting version:", err)
return false, "", ""
}
v := semver.MustParse(currentVersion)
if !found || latest.Version.LTE(v) {
log.Println("Current version is the latest")
return false, "", ""
}
return true, latest.Version.String(), latest.ReleaseNotes
}
Love the work you're doing on the log analyser 🔥
Would love a guide on how to do this in the docs ;-)
@annikovk thanks for the example, I am going to use this route then. It's still a bit fuzzy for me how the actual update should happend - I can picture it for linux or windows where I get a single executable, but what about macos where it's a .app
file, with moving parts ? The download and extracting and replacing is something we have to build or it's provided by the lib ? What's your experience with it ?
I would probably use the go selfupdate if it had the features I wanted. For now I enabled the ability to download an exe from a url (not sure on the api setup yet) and it gives download progress (which go-selfupdate does not). I'd be happy to have a sorta package or something around it for people who want it. This does mean writing some sort of syntax for the download URL in such and so it might take some time. Let me know if you people are interested in this.
Maybe building something internal for this ? Tauri's implementation is interesting to look at
Just wanted to point out to another selfupdate solution : https://github.com/fynelabs/selfupdate , used mostly by Fyne related project, but it is not depending on it and can be use by any other go project.
It gives progress, work on MacOS, Linux and Windows.
I'm working with the minio/selfupdate package to self update. It works, sort of. After the update the app opens however, any tags used (Build version for example) are not kept through the update.
The code is pretty straight forward
err = selfupdate.Apply(resp.Body, selfupdate.Options{
TargetPath: exPath,
})
I use the myapp.app/Contents/MacOS/binary.app
to self update with. I couldn't get the .app
to work
Am I missing something?
Only update the binary itself is not enough. In macOS app/dmg file, the binary can't run if other files don't match, such as codesigning and notarizing
@leaanthony So I noticed this is no longer on the milestone, is this still on the roadmap though?
It is on the roadmap but has been rescheduled for v3: https://github.com/wailsapp/wails/discussions/1484
Yeah, there are currently ways to do this already (see riftshare) so it's not a priority to bake into the project. There's also been very mixed feedback about how it should work (GitHub vs S3 vs etc etc)
@annikovk I implemented a self-update mechanism as well with rhysd/go-github-selfupdate.
It works well but only if the binary is in a folder that doesn't require admin/root rights to write in. So this is problematic if the binary is in /usr/bin/
or in windows' programs folder. I was wondering if you also encountered this issue, and if so, how did you fix it ? (ask the user for admin rights ? if so, how ? something else ?
Yeah, there are currently ways to do this already (see riftshare) so it's not a priority to bake into the project. There's also been very mixed feedback about how it should work (GitHub vs S3 vs etc etc)
I'm not a gopher so this may be a dumb question, but since this is a golang project, and golang goes hard on github, why isn't github the obvious first choice?
Btw, the riftshare code for selfupdate is at https://github.com/achhabra2/riftshare/blob/main/internal/update/selfupdate.go for those curious.
I'm not a gopher so this may be a dumb question, but since this is a golang project, and golang goes hard on github, why isn't github the obvious first choice?
Btw, the riftshare code for selfupdate is at https://github.com/achhabra2/riftshare/blob/main/internal/update/selfupdate.go for those curious.
Indeed. Also, different people want different things. There's a plugin system for wails3 that's working pretty well in the pre-alpha. I think that's an ideal candidate for this.
Is it safe/good idea to use rhysd/go-github-selfupdate?
The latest activity is from Jan 13, 2021
🤔
I wanted to add this feature to my wails app recently. I choosed to create my own library to handle this. Why ? because other libraries are either relying on storage object (s3) or are behaving like the binary is located in $GOBIN (which is not always the case with a builded wails app). My lib relies on github releases. It's a bit experimental, it seems to work on linux, didn't really try on windows. It let the user of the library choose if it will just check if there is a new version or if it will check and update. You can find it here.
don't hesitate to use it, fork it, improve it, takes some part of it if that can help.
It looks like in production it has not the permission to run 'ditto' at least I got some errors there
Looks like it needs another process to replace itself. So really self-update is not possible a.t.m. I think i will just add a button if update is available to download (then permission will be required on mac to download) and then after dowloading redirecting the user to the install .pkg
Investigate https://github.com/minio/selfupdate