1#!/usr/bin/env nix-shell
2#!nix-shell -i bash -p curl common-updater-scripts
3
4oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion wiki-js" | tr -d '"')"
5latestTag="$(git ls-remote --tags --sort="v:refname" https://github.com/Requarks/wiki.git | tail -1 | awk '{ print $2 }' | sed -E "s,^refs/tags/v(.*)$,\1,")"
6
7targetVersion="${1:-$latestTag}"
8if [ ! "${oldVersion}" = "${targetVersion}" ]; then
9 update-source-version wiki-js "${targetVersion}"
10 nix-build -A wiki-js
11else
12 echo "wiki-js is already up-to-date"
13fi