@@ -444,31 +444,74 @@ jobs:
444444 ./mc cp release_notes.txt "${{ env.MINIO_BUCKET_PATH }}/${{ env.VERSION }}${{ env.BUILD_TAG }}/release_notes.txt"
445445
446446 - name : Send Release Info to Discord
447+ shell : bash
447448 env :
448449 DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
450+ WIN_EXE_URL : ${{ env.WIN_EXE_URL }}
451+ WIN_MSI_URL : ${{ env.WIN_MSI_URL }}
452+ LINUX_APPIMAGE_URL : ${{ env.LINUX_APPIMAGE_URL }}
453+ LINUX_DEB_URL : ${{ env.LINUX_DEB_URL }}
454+ ARM7_APPIMG_URL : ${{ env.ARM7_APPIMG_URL }}
455+ ARM64_APPIMG_URL : ${{ env.ARM64_APPIMG_URL }}
456+ MAC_DMG_URL : ${{ env.MAC_DMG_URL }}
457+ MAC_ZIP_URL : ${{ env.MAC_ZIP_URL }}
449458 run : |
450- RELEASE_NOTES=$(cat release_notes.txt)
451- BASE_URL="https://uploadminioger1.nekosunevr.co.uk/nekosunetools/pulsoidapp/release/${{ needs.prepare.outputs.version }}-v${{ needs.prepare.outputs.build_tag }}"
452-
453- LINKS="• [Windows (EXE)](${{ env.WIN_EXE_URL}})\n• [Windows (MSI)](${{ env.WIN_MSI_URL}})\n• [Linux x64 AppImage](${{ env.LINUX_APPIMAGE_URL}})\n• [Linux x64 .deb](${{ env.LINUX_DEB_URL}})\n• [Raspberry Pi ARMv7 AppImage](${{ env.ARM7_APPIMG_URL}})\n• [Raspberry Pi ARM64 AppImage](${{ env.ARM64_APPIMG_URL}})\n• [macOS DMG](${{ env.MAC_DMG_URL}})\n• [macOS ZIP](${{ env.MAC_ZIP_URL}})\n"
459+ set -euo pipefail
454460
455- JSON_PAYLOAD=$(jq -n \
461+ jq -n \
462+ --rawfile notes release_notes.txt \
456463 --arg content "<@&1384262560395559122> **UPDATE (ALL PLATFORMS)**" \
457464 --arg title "New Release: v${{ needs.prepare.outputs.version }}" \
458- --arg description "$RELEASE_NOTES\n\n**Available Artifacts:**\n$LINKS" \
465+ --arg WIN_EXE_URL "$WIN_EXE_URL" \
466+ --arg WIN_MSI_URL "$WIN_MSI_URL" \
467+ --arg LINUX_APPIMAGE_URL "$LINUX_APPIMAGE_URL" \
468+ --arg LINUX_DEB_URL "$LINUX_DEB_URL" \
469+ --arg ARM7_APPIMG_URL "$ARM7_APPIMG_URL" \
470+ --arg ARM64_APPIMG_URL "$ARM64_APPIMG_URL" \
471+ --arg MAC_DMG_URL "$MAC_DMG_URL" \
472+ --arg MAC_ZIP_URL "$MAC_ZIP_URL" \
459473 --argjson color 65280 \
460474 --arg footer "Released by GitHub Actions" \
461- --arg timestamp "$(date --iso-8601=seconds)" \
462- ' {
475+ --arg timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
476+ '
477+ def trunc(s; n): if (s|length) > n then (s[0:(n-1)] + "…") else s end;
478+
479+ # Build the artifacts list with real newlines via join("\n")
480+ def artifacts_block:
481+ "**Available Artifacts:**\n" +
482+ ([
483+ "• [Windows (EXE)](" + $WIN_EXE_URL + ")",
484+ "• [Windows (MSI)](" + $WIN_MSI_URL + ")",
485+ "• [Linux x64 AppImage](" + $LINUX_APPIMAGE_URL + ")",
486+ "• [Linux x64 .deb](" + $LINUX_DEB_URL + ")",
487+ "• [Raspberry Pi ARMv7 AppImage](" + $ARM7_APPIMG_URL + ")",
488+ "• [Raspberry Pi ARM64 AppImage](" + $ARM64_APPIMG_URL + ")",
489+ "• [macOS DMG](" + $MAC_DMG_URL + ")",
490+ "• [macOS ZIP](" + $MAC_ZIP_URL + ")"
491+ ] | join("\n"));
492+
493+ {
463494 username: "Pulsoid APP Bot",
464495 avatar_url: "https://cdn.discordapp.com/icons/1310653602951594024/cb8a2781368442a92b33dd2cb93b3afd.webp?size=512",
465496 content: $content,
466- embeds: [{
467- title: $title,
468- description: $description,
469- color: $color,
470- footer: { text: $footer },
471- timestamp: $timestamp
472- }]
473- }' )
474- curl -H "Content-Type : application/json" -d "$JSON_PAYLOAD" "$DISCORD_WEBHOOK"
497+ allowed_mentions: { parse: ["roles"] },
498+ embeds: [
499+ {
500+ title: $title,
501+ description: trunc(($notes + "\n\n" + artifacts_block); 4096),
502+ color: $color,
503+ footer: { text: $footer },
504+ timestamp: $timestamp
505+ }
506+ ]
507+ }' > payload.json
508+
509+ http_code=$(curl -sS -o response.txt -w "%{http_code}" \
510+ -H "Content-Type: application/json" \
511+ -d @payload.json \
512+ "$DISCORD_WEBHOOK")
513+
514+ echo "Discord HTTP $http_code"
515+ if [[ "$http_code" != "204" && "$http_code" != "200" ]]; then
516+ echo "Error from Discord:"; cat response.txt; exit 1
517+ fi
0 commit comments