Skip to content

Instantly share code, notes, and snippets.

@Integralist
Last active February 23, 2024 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Integralist/0a685f3128597a18107ced7367b8a5bd to your computer and use it in GitHub Desktop.
Save Integralist/0a685f3128597a18107ced7367b8a5bd to your computer and use it in GitHub Desktop.
[Download latest GitHub Asset Release] #github #asset #release
.PHONY: bin-viceroy
bin-viceroy: # Download latest version of Viceroy to ./bin/ directory
@arch=$$(uname -m | sed 's/x86_64/amd64/'); \
os=$$(uname -s | tr '[:upper:]' '[:lower:]'); \
url=$$(curl -s https://api.github.com/repos/fastly/viceroy/releases/latest | jq --arg arch $$arch --arg os $$os -r '.assets[] | select((.name | contains($$arch)) and (.name | contains($$os))) | .browser_download_url'); \
filename=$$(basename $$url); \
curl -sLO $$url && mkdir -p bin && tar -xzvf $$filename --directory ./bin/ && \
./bin/viceroy --version && rm $$filename && sudo cp ./bin/viceroy /usr/local/bin/viceroy # NOTE: sudo is a no-op in GitHub Actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment