How to get latest version number with script?

Hello.

I usually update Nextcloud by downloading the tar archive of the latest (stable) release.
And I use a shell script on the server to automate this.

For this script I need a way to query what the latest stable release is.
Is there a reliable way for this that you can recommend?

Thank you very much.

Nani

1 Like

Atom feed?

https://github.com/nextcloud/server/releases.atom

Via the Github API

https://api.github.com/repos/nextcloud/server/releases/latest

The atom feed features all kinds of releases incl. RC which makes it harder to parse.
The github API woud be my first choice but it doesn’t (always) seem to be up-to-date. It’s at 0.9.5.2 while the latest current stable (official) release at this time that you can download from their web site seems to be 0.9.5.3.

Nextcloud / owncloud both have internal update routines. Do you happen to know the URL they use to find out the latest stable release?

Well, the downloads are listed THERE, but you would still need to check the folder regularly and tell your script to pick upgrades as well, but it’s quite dangerous to upgrade via script.

It would be nice if the releases folder had a symlink in it that always went to the latest release, called something like -nextcloud-latest.zip or something. Maybe the OP’s issue would be helped if we also had a single small file with details about the latest version like the size, version number, release date etc.

All very good ideas. I think it’s 2 things:

  • first I need a way to find out the version number of the latest stable official release. That could either be done with the ‘latest release’ github tag provided it’s always up-to-date. Or with the help of some info file. Or some other way I can’t think of right now. I’m not the expert.
  • and then I need a way to download the latest release. IF the result of the query above is reliable, meaning if it actually spits out the latest version number and is not lagging behind (like right now), then the script can easily put that version number into the download URL to get the latest version. Otherwise a file called nextcloud-latest.tar.bz or something might be useful.

But as you can see, everything depends on whether my script can reliably find out what the version number of the latest official stable build is. And that’s not obvious right now (not to me anyway).