Bash script to check for latest released version

I’m trying to find somewhere to capture the latest version released via bash script

So I can then compare it to

grep VERSION_ID /etc/os-release

Github api seems the obvious place but I’m note sure if my query is incorrect or it’s got something to do with the latest release being marked differently

curl -s
  "message": "Not Found",
  "documentation_url": ""

compare with:

curl -s # grep tag_name

I’m not tied to using github is there’s another/ better reliable location?

I’ve a few pis running at remote locations for family members and I appreciate I can just cron dist-upgrade but I want to control the version updates as I’m using mysql.

Suspect I’m being really stupid here so thanks for bearing with me

You can try comparing the os-release file with the version on git here:

Perfect, thank you!

Just in case it’s useful for anyone else (and always happy to take suggestions as it’s new to me)

localversion=$(grep VERSION_ID /etc/os-release |  grep -o '".*"' | sed 's/"//g')
remoteversion=$(curl -s |  grep VERSION_ID |  grep -o '".*"' | sed 's/"//g')
if [ "$remoteversion" = "$localversion" ]
echo same version - nothing to do
echo versions difference - do something