www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Automatic update system

reply vnr <cfcr gmail.com> writes:
Hello,

I have a program written in D which is open-source on GitHub.

I would appreciate it if, when I release a new version, users 
would be notified by the program and that it offers an automatic 
update, i.e. the user doesn't have to reinstall the whole 
repository himself, but that it is updated automatically.

I haven't found any packages that directly meet my needs, but in 
the meantime I imagine that I will have to use the GitHub API, as 
well as Curl to make such a system.

Do you have any resources or suggestions as to how I could 
implement this? Thank you!
Nov 26 2020
next sibling parent Dukc <ajieskola gmail.com> writes:
On Thursday, 26 November 2020 at 12:13:59 UTC, vnr wrote:
 Hello,

 I have a program written in D which is open-source on GitHub.

 I would appreciate it if, when I release a new version, users 
 would be notified by the program and that it offers an 
 automatic update, i.e. the user doesn't have to reinstall the 
 whole repository himself, but that it is updated automatically.

 I haven't found any packages that directly meet my needs, but 
 in the meantime I imagine that I will have to use the GitHub 
 API, as well as Curl to make such a system.

 Do you have any resources or suggestions as to how I could 
 implement this? Thank you!
Make it a DUB package. It does not update 100% automatically, but notifies when updates are available. You could also make an auto-updater by hand, but that requires a networking library and won't work anyway if the user does not have permissions to change the executable. This is often the case, as the often recommended places to store the programs are `/usr/bin/` or `c:/program files/`. Neither is accessible by default priviledges. In addition, it is a lot more work to implement than making a dub package. I don't recomment absent a strong reason. If you publish your program in some other package format (apt, rpm, flatpak or nix for example), you can try to get your package into some official repository. There you can publish updates easily, and the program gets updated among the regular software updates the users do.
Nov 26 2020
prev sibling next sibling parent Andre Pany <andre s-e-a-p.de> writes:
On Thursday, 26 November 2020 at 12:13:59 UTC, vnr wrote:
 Hello,

 I have a program written in D which is open-source on GitHub.

 I would appreciate it if, when I release a new version, users 
 would be notified by the program and that it offers an 
 automatic update, i.e. the user doesn't have to reinstall the 
 whole repository himself, but that it is updated automatically.

 I haven't found any packages that directly meet my needs, but 
 in the meantime I imagine that I will have to use the GitHub 
 API, as well as Curl to make such a system.

 Do you have any resources or suggestions as to how I could 
 implement this? Thank you!
This sounds like you and your users want to use dependabot. It is free service of github. Unfortunately someone needs to add support for Dub (ruby coding). Maybe also a good candidate for GSOC21. Kind regards Andre
Nov 26 2020
prev sibling parent reply aberba <karabutaworld gmail.com> writes:
On Thursday, 26 November 2020 at 12:13:59 UTC, vnr wrote:
 Hello,

 I have a program written in D which is open-source on GitHub.

 I would appreciate it if, when I release a new version, users 
 would be notified by the program and that it offers an 
 automatic update, i.e. the user doesn't have to reinstall the 
 whole repository himself, but that it is updated automatically.

 I haven't found any packages that directly meet my needs, but 
 in the meantime I imagine that I will have to use the GitHub 
 API, as well as Curl to make such a system.

 Do you have any resources or suggestions as to how I could 
 implement this? Thank you!
Auto-updates of an installed app (.ie. if that's what you want) is done from the app's installation side of things... App Store (with a few exceptions of course). On Windows, Microsoft's new packaging stack supports that [1]. You can even set it up with your CI/CD pipelines...e.g. GitHub Actions. On Linux, both Flatpak and Snap all provide suck functionality. 1. https://docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-packaging-dot-net#:~:text=%20Setup%20the%20Windows%20Application%20Packaging%20Project%20in,make%20sure%20to%20set%20the%20Minimum...%20More%20
Nov 27 2020
parent reply aberba <karabutaworld gmail.com> writes:
On Friday, 27 November 2020 at 20:00:22 UTC, aberba wrote:
 On Thursday, 26 November 2020 at 12:13:59 UTC, vnr wrote:

 On Linux, both Flatpak and Snap all provide suck functionality.
Such* was what I meant.... 😁. On Flatpak, it's not really a pure auto-update...but users get to up update from the store. Cus some folks are skeptical about auto-updates.
 1. 
 https://docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-packaging-dot-net#:~:text=%20Setup%20the%20Windows%20Application%20Packaging%20Project%20in,make%20sure%20to%20set%20the%20Minimum...%20More%20
Nov 27 2020
parent vnr <cfcr gmail.com> writes:
Thank you for your suggestions :)

I particularly appreciate the idea of making my program a dub 
package, it allows me to be cross platform and to have no 
dependencies other than those of the default D environment. To 
the detriment of automatically updating the application, I think 
that only communicating with the GitHub API (if it's "easily 
possible") to at least know if a version is released can be a 
sufficient option, knowing that the user would only have to enter 
a dub command.

For Dependabot, I'd never heard of it, it's a pity it wasn't 
brought to Dub.

As for the Microsoft Store option, I didn't know about it, it 
seems very interesting too, nevertheless I would like to make the 
program as cross platform as possible with as little thinking as 
possible for a particular system, but I'm still keeping the idea 
for future projects.

Thanks to you all :)
Nov 28 2020