notify-discord.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. name: Discord Notification
  2. on:
  3. release:
  4. types: [published]
  5. workflow_dispatch:
  6. jobs:
  7. Discord:
  8. runs-on: ubuntu-latest
  9. name: Discord Notifier
  10. steps:
  11. - uses: actions/checkout@v3
  12. with:
  13. fetch-depth: 0
  14. - name: Get changed files since last release
  15. id: changed-files
  16. uses: tj-actions/changed-files@v34
  17. with:
  18. base_sha: ${{ github.event.release.target_commitish }}
  19. separator: "\n• "
  20. - name: Discord notification
  21. env:
  22. DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}
  23. DISCORD_AVATAR: 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
  24. DISCORD_EMBEDS: '[{
  25. "title": "🚀 New Release: ${{ github.event.release.tag_name }}",
  26. "description": "${{ github.event.release.name }}\n\n${{ github.event.release.body }}",
  27. "url": "${{ github.event.release.html_url }}",
  28. "color": 5763719,
  29. "thumbnail": {
  30. "url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
  31. },
  32. "fields": [
  33. { "name": "📦 Version", "value": "`${{ github.event.release.tag_name }}`", "inline": true },
  34. { "name": "👤 Released by", "value": "[${{ github.event.release.author.login }}](${{ github.event.release.author.html_url }})", "inline": true },
  35. { "name": "📁 Repository", "value": "[${{ github.event.repository.name }}](${{ github.event.repository.html_url }})", "inline": true },
  36. { "name": "🔗 Download", "value": "[Release Page](${{ github.event.release.html_url }})", "inline": true },
  37. { "name": "📝 Files Changed", "value": "• ${{ steps.changed-files.outputs.all_changed_files }}", "inline": false }
  38. ],
  39. "timestamp": "${{ github.event.release.published_at }}",
  40. "footer": {
  41. "text": "Workout Cool • Release",
  42. "icon_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
  43. }
  44. }]'
  45. uses: Ilshidur/action-discord@master
  46. # https://stackoverflow.com/a/68068674/19395252
  47. # https://birdie0.github.io/discord-webhooks-guide/structure/embeds.html
  48. # https://github.com/marketplace/actions/changed-files