-
Notifications
You must be signed in to change notification settings - Fork 286
37 lines (35 loc) · 1.25 KB
/
discord_release_notification.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Discord Release Notification
on:
release:
types: [published]
jobs:
notify-discord:
runs-on: ubuntu-22.04
steps:
- name: Send Notification to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# We truncate the description at the models section (starting with ### Models)
# to keep the message short.
# We have also have to format the release description for it to be valid JSON.
# This is done by piping the description to jq.
run: |
DESCRIPTION=$(echo '${{ github.event.release.body }}' | awk '/### Models/{exit}1' | jq -aRs .)
curl -H "Content-Type: application/json" \
-X POST \
-d @- \
"${DISCORD_WEBHOOK}" << EOF
{
"username": "Lightly",
"avatar_url": "https://avatars.githubusercontent.com/u/50146475",
"content": "Lightly ${{ github.event.release.tag_name }} has been released!",
"embeds": [
{
"title": "${{ github.event.release.name }}",
"url": "${{ github.event.release.html_url }}",
"color": 5814783,
"description": $DESCRIPTION
}
]
}
EOF