Add ability to post in channel
This commit is contained in:
parent
c6af07e1a8
commit
1e1c01fd97
1 changed files with 14 additions and 0 deletions
14
.github/workflows/main.yml
vendored
14
.github/workflows/main.yml
vendored
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue