|
@@ -79,17 +79,61 @@ jobs:
|
|
|
- name: Prepare Discord message
|
|
|
id: discord-message
|
|
|
run: |
|
|
|
- # Échapper les caractères spéciaux dans le JSON
|
|
|
- TITLE="🚀 New Release: ${{ steps.release-info.outputs.tag_name }}"
|
|
|
- DESCRIPTION="${{ steps.release-info.outputs.name }}"
|
|
|
- BODY="${{ steps.release-info.outputs.body }}"
|
|
|
+ # Utiliser jq pour créer un JSON valide
|
|
|
+ DESCRIPTION_FULL="${{ steps.release-info.outputs.name }}\n\n${{ steps.release-info.outputs.body }}"
|
|
|
|
|
|
- # Échapper les guillemets et les sauts de ligne pour JSON
|
|
|
- BODY_ESCAPED=$(echo "$BODY" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g')
|
|
|
- DESCRIPTION_FULL="$DESCRIPTION\\n\\n$BODY_ESCAPED"
|
|
|
-
|
|
|
- # Construire le JSON
|
|
|
- DISCORD_EMBEDS="[{\"title\": \"$TITLE\", \"description\": \"$DESCRIPTION_FULL\", \"url\": \"${{ steps.release-info.outputs.html_url }}\", \"color\": 5763719, \"thumbnail\": {\"url\": \"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}, \"fields\": [{\"name\": \"📦 Version\", \"value\": \"\`${{ steps.release-info.outputs.tag_name }}\`\", \"inline\": true}, {\"name\": \"👤 Released by\", \"value\": \"[${{ steps.release-info.outputs.author_login }}](${{ steps.release-info.outputs.author_html_url }})\", \"inline\": true}, {\"name\": \"📁 Repository\", \"value\": \"[${{ github.event.repository.name }}](${{ github.event.repository.html_url }})\", \"inline\": true}, {\"name\": \"🔗 Download\", \"value\": \"[Release Page](${{ steps.release-info.outputs.html_url }})\", \"inline\": true}, {\"name\": \"📝 Files Changed\", \"value\": \"• ${{ steps.changed-files.outputs.all_changed_files }}\", \"inline\": false}], \"timestamp\": \"${{ steps.release-info.outputs.published_at }}\", \"footer\": {\"text\": \"Workout Cool • Release\", \"icon_url\": \"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}}]"
|
|
|
+ DISCORD_EMBEDS=$(jq -n \
|
|
|
+ --arg title "🚀 New Release: ${{ steps.release-info.outputs.tag_name }}" \
|
|
|
+ --arg description "$DESCRIPTION_FULL" \
|
|
|
+ --arg url "${{ steps.release-info.outputs.html_url }}" \
|
|
|
+ --arg tag "${{ steps.release-info.outputs.tag_name }}" \
|
|
|
+ --arg author "${{ steps.release-info.outputs.author_login }}" \
|
|
|
+ --arg author_url "${{ steps.release-info.outputs.author_html_url }}" \
|
|
|
+ --arg repo "${{ github.event.repository.name }}" \
|
|
|
+ --arg repo_url "${{ github.event.repository.html_url }}" \
|
|
|
+ --arg files "${{ steps.changed-files.outputs.all_changed_files }}" \
|
|
|
+ --arg timestamp "${{ steps.release-info.outputs.published_at }}" \
|
|
|
+ '[{
|
|
|
+ "title": $title,
|
|
|
+ "description": $description,
|
|
|
+ "url": $url,
|
|
|
+ "color": 5763719,
|
|
|
+ "thumbnail": {
|
|
|
+ "url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
|
|
|
+ },
|
|
|
+ "fields": [
|
|
|
+ {
|
|
|
+ "name": "📦 Version",
|
|
|
+ "value": ("`" + $tag + "`"),
|
|
|
+ "inline": true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": "👤 Released by",
|
|
|
+ "value": ("[" + $author + "](" + $author_url + ")"),
|
|
|
+ "inline": true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": "📁 Repository",
|
|
|
+ "value": ("[" + $repo + "](" + $repo_url + ")"),
|
|
|
+ "inline": true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": "🔗 Download",
|
|
|
+ "value": ("[Release Page](" + $url + ")"),
|
|
|
+ "inline": true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": "📝 Files Changed",
|
|
|
+ "value": ("• " + $files),
|
|
|
+ "inline": false
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "timestamp": $timestamp,
|
|
|
+ "footer": {
|
|
|
+ "text": "Workout Cool • Release",
|
|
|
+ "icon_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
|
|
|
+ }
|
|
|
+ }]')
|
|
|
|
|
|
echo "discord_embeds<<EOF" >> $GITHUB_OUTPUT
|
|
|
echo "$DISCORD_EMBEDS" >> $GITHUB_OUTPUT
|