mirror of
https://github.com/ZhuJHua/moodiary.git
synced 2026-04-05 16:39:01 +08:00
54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
name: Release Notification
|
|
|
|
on:
|
|
release:
|
|
types:
|
|
- released
|
|
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: html
|
|
message: |
|
|
🎉 A new release is live! 🎉
|
|
|
|
Version: ${{ env.RELEASE_TAG }}
|
|
|
|
Release Notes:
|
|
${{ env.RELEASE_NOTES }}
|
|
|
|
🔗 View Release: ${{ env.RELEASE_URL }} |