ghublatest.dev

Get the latest release of a GitHub project

See how it works

How it works?

Did you ever want to get the latest GitHub release of a project inside a docker build, ansible or similar tools? As the url to GitHub contains the version number that you need to get from somewhere the only solution to this problem was calling the GitHub api and using some jq magic to parse out the download urls. This project aims to make this process simpler. You call this service and if a pattern matches you will be redirected to the download url.

The URLs have the following format:

https://ghublatest.dev/latest/owner/repo/pattern

The pattern needs to match the whole string, so you need to start and end with a * if you don't know the exact filename. To see the list of allowed pattern formats please have a look at the godocs of filepath.Match.
curl -ski 'https://ghublatest.dev/latest/NationalSecurityAgency/ghidra/ghidra_*.zip'
HTTP/2 307
date: Fri, 08 Dec 2023 10:36:45 GMT
content-length: 0
location: https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.4_build/ghidra_10.4_PUBLIC_20230928.zip
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
strict-transport-security: max-age=15552000; preload
server: cloudflare
curl -ski 'https://ghublatest.dev/latest/OJ/gobuster/gobuster_Windows_x86_64.zip'
HTTP/2 307
date: Fri, 08 Dec 2023 10:37:46 GMT
content-length: 0
location: https://github.com/OJ/gobuster/releases/download/v3.6.0/gobuster_Windows_x86_64.zip
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
strict-transport-security: max-age=15552000; preload
server: cloudflare

This makes it possible to easily use the domain in your dockerfiles like so

RUN wget -nv -O /tmp/ghidra.zip "https://ghublatest.dev/latest/NationalSecurityAgency/ghidra/ghidra_*.zip" && \
  unzip -qq -o /tmp/ghidra.zip -d /tmp && \
  mv /tmp/ghidra_* /opt/ghidra

Please note: GitHub has a pretty low limit on the rest API (around 900 per hour) so when the limit is hit there are no further requests allowed until the limit resets.

Please also note that API results for a repo are cached for an hour.

About the author

This tool is provided to you by Christian Mehlmauer, also known as firefart. If you like my work you can throw in a donation.