13 writeScript "update-standardnotes" ''
30 srcJson=pkgs/applications/editors/standardnotes/src.json
31 jsonPath="$tmpDir"/latest
33 oldVersion=$(jq -r .version < "$srcJson")
35 curl https://api.github.com/repos/standardnotes/app/releases/latest > "$jsonPath"
37 tagName=$(jq -r .tag_name < "$jsonPath")
39 if [[ ! "$tagName" =~ "desktop" ]]; then
40 echo "latest release '$tagName' not a desktop release"
44 newVersion=$(jq -r .tag_name < "$jsonPath" | sed s,@standardnotes/desktop@,,g)
46 if [[ "$oldVersion" == "$newVersion" ]]; then
47 echo "version did not change"
51 function getDownloadUrl() {
52 jq -r ".assets[] | select(.name==\"standard-notes-$newVersion-$1.deb\") | .browser_download_url" < "$jsonPath"
55 function setJsonKey() {
56 jq "$1 = \"$2\"" "$srcJson" | sponge "$srcJson"
59 function updatePlatform() {
62 url=$(getDownloadUrl "$upstreamPlatform")
63 hash=$(nix-prefetch-url "$url" --type sha512)
64 sriHash=$(nix hash to-sri --type sha512 $hash)
65 setJsonKey .deb[\""$nixPlatform"\"].url "$url"
66 setJsonKey .deb[\""$nixPlatform"\"].hash "$sriHash"
69 updatePlatform x86_64-linux linux-amd64
70 updatePlatform aarch64-linux linux-arm64
71 setJsonKey .version "$newVersion"