Remove docker links for discord release notification

This commit is contained in:
aditya.chandel
2025-08-06 18:49:35 -06:00
parent 401d31cc29
commit fa54fdec34

View File

@@ -176,48 +176,30 @@ jobs:
release_body=$(jq -r '.body' <<< "$release_json")
release_url=$(jq -r '.url' <<< "$release_json")
# compose image links
dockerhub_image="https://hub.docker.com/r/booklore/booklore/tags/$NEW_TAG"
ghcr_image="https://github.com/booklore-app/booklore/pkgs/container/booklore/$NEW_TAG"
# trim body if too long and append concise notice
# trim body if too long
clean_body=$(echo "$release_body" | tr -d '\r')
max_length=1800
if [ ${#clean_body} -gt $max_length ]; then
# reserve room for ellipsis and note
clean_body="${clean_body:0:$((max_length-12))}… [truncated]"
fi
# prepare embed fields
embed_title="New Release: $release_name"
dockerhub_md="[View image]($dockerhub_image)"
ghcr_md="[View image]($ghcr_image)"
# build JSON payload
payload=$(jq -n \
--arg title "$embed_title" \
--arg title "New Release: $release_name" \
--arg url "$release_url" \
--arg desc "$clean_body" \
--arg hub "$dockerhub_md" \
--arg gh "$ghcr_md" \
'{
content: null,
embeds: [{
title: $title,
url: $url,
description: $desc,
color: 3066993,
fields: [
{ name: "Docker Hub", value: $hub, inline: true },
{ name: "GHCR", value: $gh, inline: true }
]
color: 3066993
}]
}')
# debug output
echo "=== Discord payload ==="
echo "$payload"
echo "======================="
# send to Discord
curl -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL"