2022-11-20 13:34:36 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl jq git moreutils nix nix-prefetch
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
|
|
|
|
|
|
|
|
json_get() {
|
|
|
|
jq -r "$1" < 'meta.json'
|
|
|
|
}
|
|
|
|
|
|
|
|
json_set() {
|
|
|
|
jq --arg x "$2" "$1 = \$x" < 'meta.json' | sponge 'meta.json'
|
|
|
|
}
|
|
|
|
|
|
|
|
old_rev=$(json_get '.rev')
|
2022-11-30 16:24:24 +00:00
|
|
|
new_rev=$(curl -L "https://api.github.com/repos/misskey-dev/misskey/releases" 2>/dev/null | jq ".[0].tag_name" -r)
|
2022-11-20 13:34:36 +00:00
|
|
|
|
|
|
|
if [ "$new_rev" = "$old_rev" ]; then
|
|
|
|
echo "misskey is up-to-date."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
json_set '.rev' "$new_rev"
|
|
|
|
new_sha256=$(nix-prefetch fetchFromGitHub --owner misskey-dev --repo misskey --rev "$new_rev")
|
2022-11-30 16:24:24 +00:00
|
|
|
json_set '.sha256' "$new_sha256"
|