Skip to content

Release Notification #5

Release Notification

Release Notification #5

Workflow file for this run

name: Release Notification
on:
release:
types:
- publish
workflow_dispatch:
jobs:
notify-telegram:
name: Notify Telegram
runs-on: ubuntu-latest
steps:
- name: Get Latest Release Info
id: get_latest_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Use GitHub API to fetch the latest release
response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/releases/latest")
# Parse the response to extract needed fields
RELEASE_TAG=$(echo "$response" | jq -r '.tag_name')
RELEASE_NAME=$(echo "$response" | jq -r '.name')
RELEASE_NOTES=$(echo "$response" | jq -r '.body')
RELEASE_URL=$(echo "$response" | jq -r '.html_url')
# Export as environment variables
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
echo "RELEASE_NOTES=$RELEASE_NOTES" >> $GITHUB_ENV
echo "RELEASE_URL=$RELEASE_URL" >> $GITHUB_ENV
- name: Send Telegram Message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
🎉 *A new release is live!* 🎉
**Release Name:** ${{ env.RELEASE_NAME }}
**Tag:** ${{ env.RELEASE_TAG }}
**Release Notes:**
${{ env.RELEASE_NOTES }}
🔗 [View Release](${{ env.RELEASE_URL }})