Files
XC_VM/.github/workflows/release-notifier.yml
T
2025-12-03 18:26:27 +03:00

49 lines
1.6 KiB
YAML

name: Release Notifier
on:
release:
types: [published, prereleased]
jobs:
notify-telegram:
runs-on: ubuntu-latest
steps:
- name: Send Release Notification to Telegram
env:
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TOPIC_ID: ${{ secrets.TELEGRAM_TOPIC_ID }}
run: |
# Определяем тип релиза и соответствующий эмодзи
if [ "${{ github.event.release.prerelease }}" == "true" ]; then
RELEASE_TYPE="Prerelease"
RELEASE_EMOJI="🧪"
RELEASE_BADGE="BETA"
else
RELEASE_TYPE="Release"
RELEASE_EMOJI="🚀"
RELEASE_BADGE="STABLE"
fi
RELEASE_TAG=${GITHUB_REF#refs/tags/}
MESSAGE=$(cat <<EOF
${RELEASE_EMOJI} *${RELEASE_TYPE} Published* ${RELEASE_EMOJI}
📍 *Status:* \`${RELEASE_BADGE}\`
🔗 *Release:* [${{ github.event.release.name }}](https://github.com/${{ github.repository }}/releases/tag/${RELEASE_TAG})
📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
🏷 *Version:* \`${RELEASE_TAG}\`
EOF
)
curl -s -X POST \
-H "Content-Type: application/json" \
-d "{
\"chat_id\": \"$CHAT_ID\",
\"message_thread_id\": \"$TOPIC_ID\",
\"text\": \"$MESSAGE\",
\"parse_mode\": \"Markdown\"
}" \
"https://api.telegram.org/bot$BOT_TOKEN/sendMessage"