How to apt install latest release from GitHub

Did you already had the issue you wanted to install a release via apt from GitHub release pages?

Here is the solution:

#!/bin/sh
GIT_USER=user
GIT_PROJECT=project

mkdir -p /tmp/webinstall
cd /tmp/webinstall

URL=$(curl -s https://api.github.com/repos/${GIT_USER}/${GIT_PROJECT}/releases/latest | jq -r '.assets[] | select(.name|match("linux-amd64.deb$")) | .browser_download_url')

curl -OL $URL
apt install ./*.deb

rm *.deb

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.