fetch-release: write error messages to stderr

Previously, when used to update `nix-bitcoin-release`, the error
wasn't displayed but instead written to `nix-bitcoin-release`.

Also, show curl error messages.
This commit is contained in:
Erik Arvstedt 2021-09-13 10:19:30 +02:00
parent cf70d05be0
commit 52aaa8388e
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -6,7 +6,7 @@ scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
repo=fort-nix/nix-bitcoin
if [[ ! -v version ]]; then
version=$(curl --silent "https://api.github.com/repos/$repo/releases/latest" | jq -r '.tag_name' | tail -c +2)
version=$(curl -s --show-error "https://api.github.com/repos/$repo/releases/latest" | jq -r '.tag_name' | tail -c +2)
fi
TMPDIR=$(mktemp -d)
@ -23,12 +23,12 @@ gpg --homedir $GPG_HOME --list-keys 36C71A37C9D988BDE82508D9B1A70E4F8DCD0366 > /
# Fetch nar-hash of release
cd $TMPDIR
baseUrl=https://github.com/$repo/releases/download/v$version
curl --silent -L -O $baseUrl/nar-hash.txt
curl --silent -L -O $baseUrl/nar-hash.txt.asc
curl -s --show-error -L -O $baseUrl/nar-hash.txt
curl -s --show-error -L -O $baseUrl/nar-hash.txt.asc
# Verify signature for nar-hash
gpg --homedir $GPG_HOME --verify nar-hash.txt.asc &> /dev/null || {
echo "Error: Signature verification failed. Please open an issue in the project repository."
>&2 echo "Error: Signature verification failed. Please open an issue in the project repository."
exit 1
}