Skip to content

Commit cf3ab84

Browse files
authored
ci: broadcast release on discord (#1594)
1 parent a4ba973 commit cf3ab84

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/create-gh-release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,22 @@ jobs:
3636
with:
3737
body_path: release_notes.txt
3838
tag_name: ${{ github.ref_name }}
39+
40+
- name: Broadcast release on Discord
41+
env:
42+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
43+
RELEASE_BODY: ${{ steps.generate_release_notes.outputs.changelog }}
44+
RELEASE_URL: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
45+
RELEASE_TAG: ${{ github.ref_name }}
46+
run: |
47+
processed_body=$(echo "$RELEASE_BODY" | perl -0777 -pe 's/\n*### (\S+) (.+?)\n+/\n### `\1` \2\n/g')
48+
final_content=$(printf "%s\n%s" "-# Read the [GitHub release](<${RELEASE_URL}>)." "$processed_body")
49+
jq -n \
50+
--arg content "$final_content" \
51+
--arg username "Tempest ${RELEASE_TAG}" \
52+
'{
53+
content: $content,
54+
username: $username
55+
}' | curl -X POST "$DISCORD_WEBHOOK" \
56+
-H "Content-Type: application/json" \
57+
-d @-

0 commit comments

Comments
 (0)