From 0ce3fb1c942b317209205699e8e99049547020f0 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sat, 8 Jul 2023 15:33:06 +0200 Subject: [PATCH] push-release: use `curl -fSs` Best practice when using curl in scripts. --- helper/push-release.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/helper/push-release.sh b/helper/push-release.sh index 9cee236..773b50d 100755 --- a/helper/push-release.sh +++ b/helper/push-release.sh @@ -36,7 +36,7 @@ fi cd "${BASH_SOURCE[0]%/*}" -RESPONSE=$(curl https://api.github.com/repos/$REPO/releases/latest 2> /dev/null) +RESPONSE=$(curl -fsS https://api.github.com/repos/$REPO/releases/latest) echo "Latest release" "$(echo "$RESPONSE" | jq -r '.tag_name' | tail -c +2)" if [[ ! $DRY_RUN ]]; then @@ -75,7 +75,7 @@ if [[ $DRY_RUN ]]; then fi POST_DATA="{ \"tag_name\": \"v$releaseVersion\", \"name\": \"nix-bitcoin-$releaseVersion\", \"body\": \"nix-bitcoin-$releaseVersion\", \"target_comitish\": \"$BRANCH\" }" -RESPONSE=$(curl -H "Authorization: token $OAUTH_TOKEN" -d "$POST_DATA" https://api.github.com/repos/$REPO/releases 2> /dev/null) +RESPONSE=$(curl -fsS -H "Authorization: token $OAUTH_TOKEN" -d "$POST_DATA" https://api.github.com/repos/$REPO/releases) ID=$(echo "$RESPONSE" | jq -r '.id') if [[ $ID == null ]]; then echo "Failed to create release with $POST_DATA" @@ -84,8 +84,8 @@ fi post_asset() { GH_ASSET="https://uploads.github.com/repos/$REPO/releases/$ID/assets?name=" - curl -H "Authorization: token $OAUTH_TOKEN" --data-binary "@$1" -H "Content-Type: application/octet-stream" \ - "$GH_ASSET/$(basename "$1")" &> /dev/null + curl -fsS -H "Authorization: token $OAUTH_TOKEN" --data-binary "@$1" -H "Content-Type: application/octet-stream" \ + "$GH_ASSET/$(basename "$1")" } post_asset nar-hash.txt post_asset nar-hash.txt.asc