Commit 19eceaac authored by aucub's avatar aucub
Browse files

venera: add update script

parent df50ecff
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ flutter327.buildFlutterApplication rec {
    install -Dm0644 ./debian/gui/venera.png $out/share/pixmaps/venera.png
  '';

  passthru.updateScript = ./update.sh;

  meta = {
    description = "Comic reader that support reading local and network comics";
    homepage = "https://github.com/venera-app/venera";
+20 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl gnused jq yq nixVersions.latest bash coreutils nix-update

set -eou pipefail

ROOT="$(dirname "$(readlink -f "$0")")"

latestTag=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/venera-app/venera/releases/latest | jq --raw-output .tag_name)
latestVersion=$(echo "$latestTag" | sed 's/^v//')

currentVersion=$(nix-instantiate --eval -E "with import ./. {}; venera.version or (lib.getVersion venera)" | tr -d '"')

if [[ "$currentVersion" == "$latestVersion" ]]; then
    echo "package is up-to-date: $currentVersion"
    exit 0
fi

nix-update venera

curl https://raw.githubusercontent.com/venera-app/venera/${latestTag}/pubspec.lock | yq . >$ROOT/pubspec.lock.json