1#!/usr/bin/env nix-shell
2#!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts
3#shellcheck shell=bash
4
5set -eu -o pipefail
6
7version=$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
8 https://api.github.com/repos/artempyanykh/marksman/releases/latest | jq -e -r .tag_name)
9old_version=$(nix-instantiate --eval -A marksman.version | jq -e -r)
10
11if [[ $version == "$old_version" ]]; then
12 echo "New version same as old version, nothing to do." >&2
13 exit 0
14fi
15
16update-source-version marksman "$version"
17
18$(nix-build -A marksman.fetch-deps --no-out-link) "$(dirname -- "${BASH_SOURCE[0]}")/deps.nix"