Utilisation de --rawfile pour l'injection du corps de texte de la release

This commit is contained in:
wpetit 2022-09-08 16:30:27 +02:00
parent 356dc6d16c
commit c77c020be0

View File

@ -91,7 +91,7 @@ function retrieve_commitish_target {
function create_release {
local payload={}
payload=$(json_set "$payload" body "\"$GITEA_RELEASE_BODY\"")
payload=$(json_set "$payload" body "$GITEA_RELEASE_BODY" true)
payload=$(json_set "$payload" draft $GITEA_RELEASE_IS_DRAFT)
payload=$(json_set "$payload" name "\"$GITEA_RELEASE_VERSION\"")
payload=$(json_set "$payload" prerelease $GITEA_RELEASE_IS_PRERELEASE)
@ -113,7 +113,16 @@ function json_set {
local data=$1
local key=$2
local value=$3
echo $data | jq -cr --argjson v "$value" --arg k "$key" '.[$k] = $v'
local use_raw_file=$4
if [ "$use_raw_file" != "true" ]; then
echo $data | jq -cr --argjson v "$value" --arg k "$key" '.[$k] = $v'
else
local tmpfile=$(mktemp)
echo "$value" > "$tmpfile"
echo $data | jq -cr --rawfile v "$tmpfile" --arg k "$key" '.[$k] = $v'
rm -f "$tmpfile"
fi
}
function upload_release_attachments {