Skip to content

Release Notification #13

Release Notification

Release Notification #13

Workflow file for this run

name: Release Notification
on:
release:
types:
- publish
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
notify-telegram:
name: Notify Telegram
runs-on: ubuntu-latest
steps:
- name: Extract Release Info
id: extract_release
run: |
response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/ZhuJHua/moodiary/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<<EOF"
echo "$RELEASE_NOTES"
echo "EOF"
} >> $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!** 🎉
**Version:** ${{ env.RELEASE_TAG }}
**Release Notes:**
${{ env.RELEASE_NOTES }}
🔗 [View Release](${{ env.RELEASE_URL }})