From 0dadafbcd2852d6dd92bd3aa6cba3a82bb00ef16 Mon Sep 17 00:00:00 2001 From: overspend1 Date: Sun, 30 Nov 2025 18:50:26 +0100 Subject: [PATCH] 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! --- .github/workflows/android-build.yml | 66 +++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 615cf3b6c..bc854eae0 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -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="🚀 Overgram Android $VERSION%0A%0A" + MESSAGE+="New release is now available!%0A%0A" + MESSAGE+="✨ What's New:%0A" + MESSAGE+="• Liquid Glass design system%0A" + MESSAGE+="• Full ghost mode%0A" + MESSAGE+="• Message history database%0A" + MESSAGE+="• Material You theming%0A%0A" + MESSAGE+="📥 Download:%0A" + MESSAGE+="📱 Download APK%0A%0A" + MESSAGE+="📖 Full Release Notes:%0A" + MESSAGE+="View on GitHub%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