Inspect the history of version.txt and find the most recent version of that file whose contents matching /^\d+.\d+.\d+$/ (e.g. '1.2.3' but not '1.2.3.dev').
Look up git tags matching the semver regexp above. The github API makes this straightforward.
Two potential sources for the latest version:
Then the latest version of the repo can be downloaded via https://github.com/mitchellh/vagrant/archive/#{ SEMVER }.zip. For instance, the most recent version right now is at https://github.com/mitchellh/vagrant/archive/v1.6.3.zip.