2023-04-29 16:46:19 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
2023-07-15 17:15:38 +00:00
|
|
|
#!nix-shell -I nixpkgs=../../../../. -i bash -p common-updater-scripts jq
|
2023-04-29 16:46:19 +00:00
|
|
|
|
|
|
|
set -eo pipefail
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
new_version=$(curl --silent https://releases.raycast.com/releases/latest?build=universal | jq -r '.version')
|
|
|
|
old_version=$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)
|
2023-04-29 16:46:19 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
if [[ $new_version == $old_version ]]; then
|
2023-04-29 16:46:19 +00:00
|
|
|
echo "Already up to date."
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "raycast: $old_version -> $new_version"
|
|
|
|
sed -Ei.bak '/ *version = "/s/".+"/"'"$new_version"'"/' ./default.nix
|
|
|
|
rm ./default.nix.bak
|
|
|
|
fi
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
hash=$(nix --extra-experimental-features nix-command store prefetch-file --json --hash-type sha256 "https://releases.raycast.com/releases/$new_version/download?build=universal" | jq -r '.hash')
|
|
|
|
sed -Ei.bak '/ *hash = /{N;N; s@("sha256-)[^;"]+@"'"$hash"'@}' ./default.nix
|
2023-04-29 16:46:19 +00:00
|
|
|
rm ./default.nix.bak
|