1#!/usr/bin/env nix-shell
2#!nix-shell -i bash -p curl jq coreutils common-updater-scripts
3
4latestVersion=$(curl "https://api.github.com/repos/archimatetool/archi/tags" | jq -r '.[0].name' | tail -c +9)
5currentVersion=$(nix-instantiate --eval -E "with import ./. {}; archi.version or (lib.getVersion archi)" | tr -d '"')
6
7echo "latest version: $latestVersion"
8echo "current version: $currentVersion"
9
10if [[ "$latestVersion" == "$currentVersion" ]]; then
11 echo "package is up-to-date"
12 exit 0
13fi
14
15for i in \
16 "aarch64-darwin Archi-Mac-Silicon-$latestVersion.dmg" \
17 "x86_64-darwin Archi-Mac-$latestVersion.dmg" \
18 "x86_64-linux Archi-Linux64-$latestVersion.tgz"
19do
20 set -- $i
21 prefetch=$(nix-prefetch-url https://www.archimatetool.com/downloads/archi/$latestVersion/$2)
22 hash=$(nix-hash --type sha256 --to-sri $prefetch)
23
24 update-source-version archi $latestVersion $hash --system=$1 --ignore-same-version
25done