Download latest GitHub release

You don’t need any scripting to generate a download link for the latest release. Simply use this format:

https://github.com/:owner/:repo/zipball/:branch

Examples:

https://github.com/webix-hub/tracker/zipball/master
https://github.com/iDoRecall/selection-menu/zipball/gh-pages

If for some reason you want to obtain a link to the latest release download, including its version number, you can obtain that from the get latest release API:

GET /repos/:owner/:repo/releases/latest

Example:

$.get('https://api.github.com/repos/idorecall/selection-menu/releases/latest', function (data) {
  $('#result').attr('href', data.zipball_url);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a id="result">Download latest release (.ZIP)</a>

Leave a Comment

tech