Skip to content

Notify Discord on Release #8

Notify Discord on Release

Notify Discord on Release #8

Workflow file for this run

name: Notify Discord on Release
on:
workflow_dispatch:
release:
types:
- published
- edited
jobs:
notify-discord:
runs-on: ubuntu-latest
steps:
- name: Send release notification to Discord
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
RELEASE_BODY: ${{ github.event.release.body }}
run: |
ESCAPED_BODY=$(echo "$RELEASE_BODY" | sed ':a;N;$!ba;s/\n/\\n/g')
curl -X POST \
-H "Content-Type: application/json" \
-d "{
\"username\": \"Release Bot\",
\"avatar_url\": \"https://getautoclicker.com/docs/4.x/assets/brand/bootstrap-social-logo.png\",
\"content\": \"${{ github.actor }} published a new release: [${{ github.event.release.tag_name }}](${{ github.event.release.html_url }})\\n\\n**Release Notes:**\\n$ESCAPED_BODY\"
}" \
"$DISCORD_WEBHOOK_URL"