feat: improve Telegram notifications with direct download links
- Split notifications into build and release - Release notifications now include: - Direct APK download link (clickable) - GitHub release page link - Feature highlights - HTML formatting for better readability - Links to @overgramchat - Developer attribution - Build notifications are minimal (non-release commits) - Automatic posting when new releases are created - Users can download directly from Telegram message This means when you create a release (tag), the bot will automatically post to @overgramupdates with a direct download link!
This commit is contained in:
66
.github/workflows/android-build.yml
vendored
66
.github/workflows/android-build.yml
vendored
@@ -257,29 +257,79 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
notify-telegram:
|
||||
name: Notify Telegram Channel
|
||||
notify-telegram-build:
|
||||
name: Notify Build Complete
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-debug, build-release]
|
||||
if: github.event_name == 'push' && success()
|
||||
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') && success()
|
||||
|
||||
steps:
|
||||
- name: Send Telegram Notification
|
||||
- name: Send Build Notification
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
TELEGRAM_CHANNEL_ID: ${{ secrets.TELEGRAM_CHANNEL_ID }}
|
||||
run: |
|
||||
if [ -n "$TELEGRAM_BOT_TOKEN" ]; then
|
||||
MESSAGE="✅ Overgram Android build completed!%0A%0A"
|
||||
MESSAGE+="Build: #$GITHUB_RUN_NUMBER%0A"
|
||||
MESSAGE="🔨 Build completed%0A%0A"
|
||||
MESSAGE+="Branch: ${GITHUB_REF#refs/heads/}%0A"
|
||||
MESSAGE+="Commit: ${GITHUB_SHA:0:7}%0A"
|
||||
MESSAGE+="Download: https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
|
||||
MESSAGE+="View: https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
|
||||
|
||||
curl -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
||||
-d "chat_id=${TELEGRAM_CHANNEL_ID}" \
|
||||
-d "text=${MESSAGE}" \
|
||||
-d "parse_mode=HTML" || echo "Telegram notification skipped"
|
||||
-d "parse_mode=HTML" \
|
||||
-d "disable_web_page_preview=true" || echo "Notification skipped"
|
||||
fi
|
||||
|
||||
notify-telegram-release:
|
||||
name: Notify New Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: [create-release]
|
||||
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/rewrite')
|
||||
|
||||
steps:
|
||||
- name: Get Version
|
||||
id: version
|
||||
run: |
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
else
|
||||
VERSION="nightly-$(date +%Y%m%d)"
|
||||
fi
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Send Release Notification
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
TELEGRAM_CHANNEL_ID: ${{ secrets.TELEGRAM_CHANNEL_ID }}
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
if [ -n "$TELEGRAM_BOT_TOKEN" ]; then
|
||||
# Construct download URLs
|
||||
RELEASE_URL="https://github.com/$GITHUB_REPOSITORY/releases/tag/$VERSION"
|
||||
SIGNED_APK="https://github.com/$GITHUB_REPOSITORY/releases/download/$VERSION/overgram-signed.apk"
|
||||
|
||||
# Create message with HTML formatting
|
||||
MESSAGE="🚀 <b>Overgram Android $VERSION</b>%0A%0A"
|
||||
MESSAGE+="New release is now available!%0A%0A"
|
||||
MESSAGE+="<b>✨ What's New:</b>%0A"
|
||||
MESSAGE+="• Liquid Glass design system%0A"
|
||||
MESSAGE+="• Full ghost mode%0A"
|
||||
MESSAGE+="• Message history database%0A"
|
||||
MESSAGE+="• Material You theming%0A%0A"
|
||||
MESSAGE+="<b>📥 Download:</b>%0A"
|
||||
MESSAGE+="<a href=\"$SIGNED_APK\">📱 Download APK</a>%0A%0A"
|
||||
MESSAGE+="<b>📖 Full Release Notes:</b>%0A"
|
||||
MESSAGE+="<a href=\"$RELEASE_URL\">View on GitHub</a>%0A%0A"
|
||||
MESSAGE+="👨💻 Developed by @overspend1%0A"
|
||||
MESSAGE+="💬 Join: @overgramchat"
|
||||
|
||||
curl -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
||||
-d "chat_id=${TELEGRAM_CHANNEL_ID}" \
|
||||
-d "text=${MESSAGE}" \
|
||||
-d "parse_mode=HTML" \
|
||||
-d "disable_web_page_preview=false" || echo "Notification skipped"
|
||||
else
|
||||
echo "Telegram notification skipped (no token)"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user