MuhammedKalkan / OpenLens

OpenLens Binary Build Repository
4.07k stars 272 forks source link

Latest deb link? #130

Closed turowicz closed 1 year ago

turowicz commented 1 year ago

Can we get the OpenLens equivalent of https://api.k8slens.dev/binaries/latest.amd64.deb?

MuhammedKalkan commented 1 year ago

There already is a latest tag. Go an get there

turowicz commented 1 year ago

@MuhammedKalkan how can I download it in a script to make sure its always latest? You have a version number in the file name...

brotich commented 1 year ago

@turowicz You may be able to get the latest release here uing the github API.

You will need both jq and curl installed

script.

#!/usr/bin/env bash
set -euxo pipefail

# find the url for the lastest deb using regex
LATEST_DEB_DOWNLOAD_URL=$(curl https://api.github.com/repos/MuhammedKalkan/OpenLens/releases/latest | jq -r '.assets[]| select(.name | test("^OpenLens-\\d+\\.\\d+\\.\\d+.amd64.deb$")) | .browser_download_url')

# make sure we got the download url
if [[ -z $LATEST_DEB_DOWNLOAD_URL ]]
then
 echo "unable to get the latest download link for openlens deb download."
 exit 1
fi

# download the deb using curl
curl -L $LATEST_DEB_DOWNLOAD_URL > openlens.amd64.deb
  1. save the script above to a file i.e download.sh
  2. run bash download.sh. expect output as below
    $ bash download.sh
    ++ curl https://api.github.com/repos/MuhammedKalkan/OpenLens/releases/latest
    ++ jq -r '.assets[]| select(.name | test("^OpenLens-\\d+\\.\\d+\\.\\d+.amd64.deb$")) | .browser_download_url'
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    100 50780    0 50780    0     0  16171      0 --:--:--  0:00:03 --:--:-- 16177
    + LATEST_DEB_DOWNLOAD_URL=https://github.com/MuhammedKalkan/OpenLens/releases/download/v6.4.10/OpenLens-6.4.10.amd64.deb
    + [[ -z https://github.com/MuhammedKalkan/OpenLens/releases/download/v6.4.10/OpenLens-6.4.10.amd64.deb ]]
    + curl -L https://github.com/MuhammedKalkan/OpenLens/releases/download/v6.4.10/OpenLens-6.4.10.amd64.deb
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
    100  103M  100  103M    0     0  4270k      0  0:00:24  0:00:24 --:--:-- 6182k

    after the script is done, the deb file will be saved as openlens.amd64.deb in the current directory

turowicz commented 1 year ago

Thank you it works!