Skip to content

Notify Discord on Release #6

Notify Discord on Release

Notify Discord on Release #6

Workflow file for this run

name: Discord Notification on Release
on:
release:
types: [created]
jobs:
notify_discord:
runs-on: ubuntu-latest
steps:
- name: Send Release Notification to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
RELEASE_NAME: ${{ github.event.release.name }}
RELEASE_BODY: ${{ github.event.release.body }}
run: |
# Using jq to safely encode JSON strings
JSON_PAYLOAD=$(jq -n \
--arg content "**Release:** $RELEASE_NAME\n$RELEASE_BODY" \
'{username: "GitHub Release Bot", content: $content}')
# Sending the message to Discord
curl -H "Content-Type: application/json" \
-d "$JSON_PAYLOAD" \
$DISCORD_WEBHOOK