1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p coreutils curl jq git gnupg common-updater-scripts
5 # Fetch latest release, GPG-verify the tag, update derivation
7 scriptDir
=$
(cd "${BASH_SOURCE[0]%/*}" && pwd)
8 nixpkgs
=$
(realpath
"$scriptDir"/..
/..
/..
/..
)
10 oldVersion
=$
(nix-instantiate
--eval -E "(import \"$nixpkgs\" { config = {}; overlays = []; }).electrs.version" |
tr -d '"')
11 version
=$
(curl
-s --show-error "https://api.github.com/repos/romanz/electrs/releases/latest" | jq
-r '.tag_name' |
tail -c +2)
13 if [[ $version == $oldVersion ]]; then
14 echo "Already at latest version $version"
17 echo "New version: $version"
19 tmpdir
=$
(mktemp
-d /tmp
/electrs-verify-gpg.XXX
)
21 trap "rm -rf $tmpdir" EXIT
23 git clone
--depth 1 --branch v
${version} -c advice.detachedHead
=false https
://github.com
/romanz
/electrs
$repo
24 git
-C $repo checkout tags
/v
${version}
26 export GNUPGHOME
=$tmpdir
28 echo "Fetching romanz's key"
29 gpg
--keyserver hkps
://keys.openpgp.org
--recv-keys 15c8c3574ae4f1e25f3f35c587cae5fa46917cbb
2> /dev
/null
31 echo "Verifying commit"
32 git
-C $repo verify-tag v
${version}
35 hash=$
(nix
hash path
$repo)
37 (cd "$nixpkgs" && update-source-version electrs
"$version" "$hash" && update-source-version electrs
--ignore-same-version --source-key=cargoDeps
)
39 echo "electrs: $oldVersion -> $version"