LBNL-ETA/Radiance latest release

Hi,

I am trying to set up an automated build of a docker container and I am looking for a way to programmatically get the latest release from the github repository so I can download the precompiled binaries. The goal is to do this:

LATEST=97040891
wget https://github.com/LBNL-ETA/Radiance/releases/download/"$LATEST"/Radiance_"$LATEST"_Linux.zip
unzip Radiance_*_Linux.zip 
tar -xzf radiance-*-Linux.tar.gz 

where LATEST would be programattically assigned. I don’t otherwise ned to clone the repository and besides I don’t think I can get this information from git as something like:

git ls-remote --tags origin

does not sort by date and the tags are otherwise unordered. A quick google suggests I can do this with the github api, but before I go down that path I thought I would see if anyone has already done something similar, or since I think this repository is mostly automated if there would be an easy way to add a “latest” tag to the build process so that this url:

https:// github.com /LBNL-ETA/Radiance/releases/download/latest/Radiance_latest_Linux.zip

would always work.

UPDATE:

I found a reasonable solution that seems to work using a sparse/partial clone:

mkdir build
mkdir radiance
cd build
git clone --sparse --filter=blob:none --no-checkout https://github.com/LBNL-ETA/Radiance.git
cd Radiance
export RADVERSION=$(git ls-remote --sort=committerdate --tags | tail -1 | sed -n -e 's/^.*\///p')
cd ..
wget https://github.com/LBNL-ETA/Radiance/releases/download/"$RADVERSION"/Radiance_"$RADVERSION"_Linux.zip
unzip Radiance_*_Linux.zip 
tar -xzf radiance-*-Linux.tar.gz 
cd ../radiance
rm -rf bin lib man
mv ../build/radiance-*-Linux/usr/local/radiance/* ./
rm -rf ../build

I’ll check it a few times as the next few releases drop

Hi Stephen,

Indeed you can do this with GitHub api. It seems this might work:
curl -s https://api.github.com/repos/LBNL-ETA/Radiance/releases\?per_page\=1 | grep "browser_download_url.*Linux.zip" | cut -d: -f2,3 | tr -d \" | wget -

With their command line tool gh, this should also work:
ver=$(gh release list -R LBNL-ETA/Radiance -L 1 | cut -f 3)
gh release download $ver -R LBNL-ETA/Radiance -p '*Linux.zip'

1 Like

Hi Taoning,

Thanks, this is perfect!

One small edit: at least on macos and my linux systems wget needs to be: wget -i -