Skip to content

Notify Discord on Release #10

Notify Discord on Release

Notify Discord on Release #10

Workflow file for this run

name: Notify Discord on Release
on:
release:
types: [created]
jobs:
discord_notification:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Send notification to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
RELEASE_TAG="${{ github.event.release.tag_name }}"
RELEASE_BODY="${{ github.event.release.body }}"
# Escape double quotes in release body
ESCAPED_BODY="${RELEASE_BODY//$'\"'/$'\\\"'}"
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"🎉 *New Release:* **${RELEASE_TAG}**\\n\\n${ESCAPED_BODY}\\n\\n[View Release](https://github.com/${GITHUB_REPOSITORY}/releases/tag/${RELEASE_TAG})\"}" \
$DISCORD_WEBHOOK