Add ability to post in channel

This commit is contained in:
frknkrc44 2025-09-06 00:34:18 +03:00
commit 1e1c01fd97
No known key found for this signature in database
GPG key ID: 784AE1CC0DCFD34F

View file

@ -87,3 +87,17 @@ jobs:
with:
name: mappings
path: "app/build/outputs/mapping/release"
- name: Post to channel
if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/master' }}
env:
CHANNEL_ID: ${{ secrets.TELEGRAM_CHANNEL }}
BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
COMMIT_URL: ${{ github.event.head_commit.url }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
OUTPUT="app/build/outputs/apk/"
export release=$(find $OUTPUT -name "*-release.apk")
export debug=$(find $OUTPUT -name "*-debug.apk")
ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'`
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://release%22%7D,%7B%22type%22:%22document%22,%20%22media%22:%22attach://debug%22,%22caption%22:${ESCAPED}%7D%5D" -F release="@$release" -F debug="@$debug"