Getting the latest release from github

This is a topic that has plagued me for a bit now. The only way I knew was to visit the announcement thread, or go through each GitHub repo separately and note the latest release.

So … I found a better way, and I’m sharing it here for anyone else building all of the gvm tools on a regular basis.

In short, it uses the github API, and some awk/sed foo to retrieve the current release version and then writes the versions out to an rc file (build.rc). You can then source the rc file in your build scripts to have the most recent release. (Don’t build from master, everyone admits that will most likely not work.)

You can find this script ( and the build script I use ( to build gvm in a container here:

It’s currently written to use a personal access token with github. To use the script as-is, you’ll need to create a “.token” file for the script to source with your token in it. The content of that file would only be:

token="<your token value here>"

Alternatively, you could remove the -H "Authorization: token $Oauth" from the curl lines in the script and it will work too. But you will be limited in the number of times you run it as it will hit the API rate limits pretty quickly on github.

If you need to create a token, go here:

OK … here’s the script itself.

# create the build.rc file with the latest release versions of each tool
echo "Checking github for the latest releases."
rm build.rc
# Source the api token
. .token
for repo in gvmd openvas openvas-smb gvm-libs openvas-scanner gsa ospd ospd-openvas ; do
        VERSION=$(curl -s -H "Authorization: token $Oauth" -L$repo/releases/latest |  jq -r ".assets[].browser_download_url" | sed "s/^.*download\/\(v.*\)\/.*$/\1/" | head -1)
        echo "$repo current version is $VERSION"
        VAR=$( echo $repo | tr - _ )
        echo "$VAR=$VERSION" >> build.rc
for repo in python-gvm gvm-tools; do
        python_gvm=$(curl -s -H "Authorization: token $Oauth" -L$repo/releases/latest |  jq -r ".tarball_url" | awk -F/ '{print $NF}' )
        echo "$repo current version is $python_gvm"
        VAR=$(echo $repo | tr - _ )
        echo "$VAR=$python_gvm" >> build.rc

Please feel free to comment mock or praise. If you know a better way, please enlighten me.


1 Like