For languages that properly tag versions on github, using github.com/repoSlug/releases/latest redirect should be the best.
For example: https://github.com/apple/swift/releases/latest
Otherwise parsing the HTML of the download page seems to be the best option, for example the first <div class="toggleVisible" id="gox.y.z"> on https://golang.org/dl/ will give us the latest stable version.