scripts/devel/update-amm

22 lines
643 B
Plaintext
Raw Normal View History

2019-09-30 12:49:14 +00:00
#!/bin/zsh
2023-03-02 15:02:42 +00:00
versions=$(curl -sL https://api.github.com/repos/lihaoyi/Ammonite/releases/latest)
2019-09-30 12:49:14 +00:00
download-version() {
2023-03-02 15:02:42 +00:00
version=$(jq ".assets | map(select(.name | startswith(\"$1\")))[0]" <<<$versions)
target=$(jq -r ".browser_download_url" <<<$version)
timestamp=$(jq -r ".updated_at" <<<$version)
if [[ $1 == "-n" ]]; then
echo $target
elif [[ $(date -d $timestamp +%s) -lt $(date -r $2 +%s) ]]; then
echo "No update for $1"
else
echo "Updating $1 to $(jq .name <<<$version)"
curl -L $target > $2
chmod +x $2
fi
2019-09-30 12:49:14 +00:00
}
download-version 2.13 $(which amm)2.13
2019-09-30 12:49:14 +00:00
download-version 2.12 $(which amm)2.12
2024-04-29 12:26:26 +00:00
download-version 3.3 $(which amm)3