Notify Discord on Release #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |