nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 41 lines 1.5 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 5trap 'echo "Error at ${BASH_SOURCE[0]}:$LINENO"' ERR 6 7# Fetch latest release, GPG-verify the tag, update derivation 8 9scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd) 10nixpkgs=$(realpath "$scriptDir"/../../../..) 11 12oldVersion=$(nix-instantiate --eval -E "(import \"$nixpkgs\" { config = {}; overlays = []; }).electrs.version" | tr -d '"') 13version=$(curl -s --show-error "https://api.github.com/repos/romanz/electrs/releases/latest" | jq -r '.tag_name' | tail -c +2) 14 15if [[ $version == $oldVersion ]]; then 16 echo "Already at latest version $version" 17 exit 0 18fi 19echo "New version: $version" 20 21tmpdir=$(mktemp -d /tmp/electrs-verify-gpg.XXX) 22repo=$tmpdir/repo 23trap "rm -rf $tmpdir" EXIT 24 25git clone --depth 1 --branch v${version} -c advice.detachedHead=false https://github.com/romanz/electrs $repo 26git -C $repo checkout tags/v${version} 27 28export GNUPGHOME=$tmpdir 29echo 30echo "Fetching romanz's key" 31gpg --keyserver hkps://keys.openpgp.org --recv-keys 15c8c3574ae4f1e25f3f35c587cae5fa46917cbb 2> /dev/null 32echo 33echo "Verifying commit" 34git -C $repo verify-tag v${version} 35 36rm -rf $repo/.git 37hash=$(nix --extra-experimental-features nix-command hash path $repo) 38 39(cd "$nixpkgs" && update-source-version electrs "$version" "$hash" && update-source-version electrs --ignore-same-version --source-key=cargoDeps.vendorStaging) 40echo 41echo "electrs: $oldVersion -> $version"