name: Notify Telegram on Release

on:
  release:
    types: [published]

jobs:
  send_message:
    runs-on: ubuntu-latest
    steps:
      - name: Send Telegram Message
        run: |
          msg_text='
          📢 A new release of ${{ github.repository }} is published: ${{ github.event.release.tag_name }}
          Release Name: ${{ github.event.release.name }}
          Description: ${{ github.event.release.body }}
          You can check updates in Zotero to get the latest version, or view on GitHub: ${{ github.event.release.html_url }}'
          curl -s -X POST 'https://api.telegram.org/bot${{ secrets.TG_BOT_TOKEN }}/sendMessage' \
          -d "chat_id=${{ secrets.TG_CHAT_ID }}&text=${msg_text}&reply_to_message_id=${{ secrets.TG_MSG_ID }}"
