Using GitHub\'s Release feature, it is possible to provide a link to download a specific version of the published software. However, every time a release is made, the gh-pag
The Linking to releases help page does mention a "Latest Release" button, but that doesn't get you a download link.
https://github.com/reactiveui/ReactiveUI/releases/latest
For that, you need to get the latest tag first (as mentioned in "GitHub URL for latest release of the download file?"):
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
curl -L https://github.com/reactiveui/ReactiveUI/releases/download/$latestTag/ReactiveUI-$latestTag.zip
Just use one of the urls below to download the latest release: (took urls from boxbilling project for example): https://api.github.com/repos/boxbilling/boxbilling/releases
Download the latest release as zip: https://api.github.com/repos/boxbilling/boxbilling/zipball
Download the latest release as tarball: https://api.github.com/repos/boxbilling/boxbilling/tarball
Click on one of the urls to download the latest release instantly. As i wrote this lines it's currently: boxbilling-boxbilling-4.20-30-g452ad1c[.zip/.tar.gz]
UPDATE: Found an other url in my logfiles (ref. to example above) https://codeload.github.com/boxbilling/boxbilling/legacy.tar.gz/master
Linux solution to get latest release asset download link (works only if release has one asset only)
curl -s https://api.github.com/repos/boxbilling/boxbilling/releases/latest | grep browser_download_url | cut -d '"' -f 4
I want to download the releases from the README.md
file in the repository description. There, I cannot execute JavaScript.
I can add links like these to the README file or github pages for all of my repositories:
https://niccokunzmann.github.io/download_latest/<USER>/<REPOSITORY>/<FILE>
https://niccokunzmann.github.io/download_latest/<FILE>
document.referrer
. Thus, the link will also work for forks.You can find the source code here, fork or just use my repo.
in PHP - redirect to the latest release download. Simply put on your webspace
<?php
/**
* Download latest release from github release articats
* License: Public Domain
*/
define('REPO', 'imi-digital/iRobo');
$opts = [
'http' => [
'method' => 'GET',
'header' => [
'User-Agent: PHP'
]
]
];
$context = stream_context_create($opts);
$releases = file_get_contents('https://api.github.com/repos/' . REPO . '/releases', false, $context);
$releases = json_decode($releases);
$url = $releases[0]->assets[0]->browser_download_url;
header('Location: ' . $url);
This is for Linux.
I saw the above accepted answer
A few years late, but I just implemented a simple redirect to support https://github.com/USER/PROJECT/releases/latest/download/package.zip. That should redirected to the latest tagged package.zip release asset. Hope it's handy!
by Joshua Peek but a comment noted it didn't support versioned file names.
After searching for a bit, I made up a one line call that works for versioned file names. It uses curl to get the latest file version and then makes use of the redirect support that was added to download the latest versioned file.
wget $'https://github.com/<UMBRELLA PROJECT>/<REPO NAME>/releases/latest/download/<FILE NAME START>-'$(curl -s https://github.com/<UMBRELLA PROJECT>/<REPO NAME>/releases/latest | grep -o -P '(?<=releases/tag/).*(?=\">)')$'<FILE NAME END>'
So it targets a file that's named like <REPO NAME>-linux64_arm-<VERSION NUMBER>.tar.gz
that's on the webpage https://github.com/<UMBRELLA PROJECT>/<REPO NAME>/releases/latest
after it redirects. It does this by looking for the <VERSION NUMBER>
between releases/tag/
and the ">
in the text that's returned from the curl call. So to be really explicit, <FILE NAME START>
is the <REPO NAME>-linux64_arm-
and <FILE NAME END>
is the .tar.gz
in the above example. Get the START
and END
bits by looking at what the https://github.com/<UMBRELLA PROJECT>/<REPO NAME>/releases/latest
uses as its file naming scheme.
I made this up by mimicking how grep and curl were used by others and just learned all of this now, so let me know if it's doing something real naughty that I wouldn't even fathom! Also I am saying <UMBRELLA PROJECT>
but a user name should be able to go there just fine as well. Shout out to https://stackoverflow.com/a/13245961/2403531 for the grep call, https://unix.stackexchange.com/a/10264 for the $string$concatenation.