Skip to content

Commit 480ca3f

Browse files
authored
🤖 feat: add Discord release notification workflow (#940)
Adds a GitHub Actions workflow that sends release notes to Discord when a release is published. ~**Setup required:**~ ✅ Add the `DISCORD_WEBHOOK_URL` secret to the repository. _Generated with `mux`_
1 parent d991521 commit 480ca3f

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

‎.github/workflows/release.yml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,47 @@ jobs:
172172
run: bun x electron-builder --win --publish always
173173
env:
174174
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175+
176+
notify-discord:
177+
name: Notify Discord
178+
runs-on: ubuntu-latest
179+
needs: [build-macos, build-linux, build-windows, build-vscode-extension]
180+
# Only notify on actual releases, not manual workflow runs
181+
if: github.event_name == 'release'
182+
steps:
183+
- name: Send release notification to Discord
184+
env:
185+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
186+
RELEASE_TAG: ${{ github.event.release.tag_name }}
187+
RELEASE_NAME: ${{ github.event.release.name }}
188+
RELEASE_URL: ${{ github.event.release.html_url }}
189+
RELEASE_BODY: ${{ github.event.release.body }}
190+
REPO_NAME: ${{ github.repository }}
191+
run: |
192+
# Truncate body so we don't blow up Discord
193+
BODY="${RELEASE_BODY}"
194+
if [ ${#BODY} -gt 1500 ]; then
195+
BODY="${BODY:0:1500}..."
196+
fi
197+
198+
# Build JSON payload with proper escaping via jq
199+
jq -n \
200+
--arg title "New release: ${RELEASE_NAME:-$RELEASE_TAG}" \
201+
--arg url "$RELEASE_URL" \
202+
--arg body "$BODY" \
203+
--arg repo "$REPO_NAME" \
204+
'{
205+
username: "GitHub Releases",
206+
embeds: [{
207+
title: $title,
208+
url: $url,
209+
description: $body,
210+
footer: { text: $repo }
211+
}]
212+
}' > payload.json
213+
214+
# Send to Discord
215+
curl -X POST \
216+
-H "Content-Type: application/json" \
217+
-d @payload.json \
218+
"$DISCORD_WEBHOOK_URL"

0 commit comments

Comments
 (0)