Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add discord release notification #1427

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/discord_release_notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Discord Release Notification

on:
release:
types: [published]

jobs:
notify-discord:
runs-on: ubuntu-latest
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
Loading