Skip to content

Move feedback form to screen #271

Move feedback form to screen

Move feedback form to screen #271

name: Telegram Notification
on:
push:
branches:
- master
paths:
- "client/**"
- "scripts/**"
- "package.json"
- "bun.lock"
- ".github/workflows/**"
- "!**/*.md"
jobs:
build:
name: Build Android App
uses: ./.github/workflows/client.yml
secrets: inherit
send_telegram_notification:
runs-on: ubuntu-latest
needs: build
steps:
- name: πŸ“₯ Download APK artifact
uses: actions/download-artifact@v8
with:
name: ${{ needs.build.outputs.apk_artifact_name }}
path: .
- name: πŸš€ Start local Telegram Bot API server
run: |
docker run -d --name local-bot-api \
-p 8081:8081 \
-v ${{ github.workspace }}:/data \
-e TELEGRAM_API_ID=${{ secrets.TELEGRAM_API_ID }} \
-e TELEGRAM_API_HASH=${{ secrets.TELEGRAM_API_HASH }} \
aiogram/telegram-bot-api:latest --local
- name: ⏳ Wait for Bot API server to be ready
run: |
echo "Waiting 5 seconds for the local Bot API server to initialize..."
sleep 5
- name: πŸ“ Prepare Telegram messages
env:
COMMIT_SHA: ${{ github.sha }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
python3 <<'PY'
import os
from pathlib import Path
sha = os.environ["COMMIT_SHA"]
short_sha = sha[:7]
commit_message = os.environ.get("COMMIT_MESSAGE", "").strip() or "(no commit message)"
caption = f"πŸ€– New Noah Android build is available!\n\nπŸ“ Commit: {short_sha}"
message = (
"πŸ€– New Noah Android build is available!\n\n"
f"πŸ“ Commit: {sha}\n"
f"πŸ’¬ Message: {commit_message}"
)
# Telegram sendMessage allows 4096 chars. Keep margin for UTF-8 edge cases.
max_message_chars = 3900
if len(message) > max_message_chars:
message = f"{message[: max_message_chars - 1]}…"
Path("telegram_apk_caption.txt").write_text(caption, encoding="utf-8")
Path("telegram_android_build_message.txt").write_text(message, encoding="utf-8")
PY
- name: πŸ“€ Send APK using local Bot API server
run: |
curl -fsS -X POST "http://localhost:8081/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument" \
-F chat_id="${{ secrets.BLIXT_CHAT_ID }}" \
-F message_thread_id="${{ secrets.BLIXT_TOPIC_ID }}" \
-F document=@"${{ needs.build.outputs.apk_filename }}" \
-F "caption=<telegram_apk_caption.txt"
- name: πŸ“’ Send Android build details
run: |
curl -fsS -X POST "http://localhost:8081/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage" \
-F chat_id="${{ secrets.BLIXT_CHAT_ID }}" \
-F message_thread_id="${{ secrets.BLIXT_TOPIC_ID }}" \
-F "text=<telegram_android_build_message.txt"
- name: πŸ›‘ Stop and remove local Bot API server
if: always()
run: |
echo "Stopping and removing the Docker container..."
docker stop local-bot-api
docker rm local-bot-api