Open MurzNN opened 3 months ago
SGTM! Any chance you'd like to open a PR for it? I can take care of uploading the script somewhere afterwards
I invented a not-one-lined script that does this:
#!/bin/bash
URL="marcosnils/bin"
LATEST_RELEASE=$(curl -s https://api.github.com/repos/$URL/releases/latest)
TAG_NAME=$(echo $LATEST_RELEASE | jq -r '.tag_name' | cut -c 2-)
FILENAME="bin_${TAG_NAME}_linux_amd64"
DOWNLOAD_URL=$(echo $LATEST_RELEASE | jq -r '.assets[] | select(.name | startswith("'"$FILENAME"'")) | .browser_download_url')
curl -s -L -o bin $DOWNLOAD_URL
chmod +x ./bin
It's complex because the release binary has the version name in the filename. If it be something static like just bin_linux_amd64
- it would be much easier to download by just like:
curl -s -L -o bin https://github.com/marcosnils/bin/releases/latest/download/bin_linux_amd64
One more example here: https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
It's complex because the release binary has the version name in the filename. If it be something static like just
bin_linux_amd64
- it would be much easier to download by just like:curl -s -L -o bin https://github.com/marcosnils/bin/releases/latest/download/bin_linux_amd64
I really would like to see this version. @marcosnils: Any chance to remove the version from the filename?
Now in the readme, we have a recommendation to Download the
bin
from the releases page manually.But for some users, and especially for automation in scripts, it's good to have a CLI command to do this directly, better as a one-liner.