Release Notification #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Notification | |
on: | |
release: | |
types: | |
- publish | |
workflow_dispatch: | |
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!* 🎉 | |
**Release Name:** ${{ env.RELEASE_NAME }} | |
**Tag:** ${{ env.RELEASE_TAG }} | |
**Release Notes:** | |
${{ env.RELEASE_NOTES }} | |
🔗 [View Release](${{ env.RELEASE_URL }}) |