Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 30 lines 1.2 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p coreutils curl jq git gnupg common-updater-scripts 3set -euo pipefail 4 5# Fetch latest release, update derivation 6scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd) 7nixpkgs=$(realpath "$scriptDir"/../../../..) 8 9oldVersion=$(nix-instantiate --eval -E "(import \"$nixpkgs\" { config = {}; overlays = []; }).teos.version" | tr -d '"') 10version=$(curl -s --show-error "https://api.github.com/repos/talaia-labs/rust-teos/releases/latest" | jq -r '.tag_name' | tail -c +2) 11 12if [[ $version == $oldVersion ]]; then 13 echo "Already at latest version $version" 14 exit 0 15fi 16echo "New version: $version" 17 18tmpdir=$(mktemp -d /tmp/teos.XXX) 19repo="${tmpdir}/repo" 20trap 'rm -rf $tmpdir' EXIT 21 22git clone --depth 1 --branch "v${version}" -c advice.detachedHead=false 'https://github.com/talaia-labs/rust-teos' "$repo" 23git -C "$repo" checkout "tags/v${version}" 24 25rm -rf "${repo}/.git" 26hashcheck=$(nix --extra-experimental-features nix-command hash path "$repo") 27 28(cd "$nixpkgs" && update-source-version teos "$version" "$hashcheck" && update-source-version teos --ignore-same-version --source-key=cargoDeps) 29echo 30echo "rust-teos: $oldVersion -> $version"