Skip to content

Commit eadbd14

Browse files
Send file to telegram (#72)
1 parent 57253c7 commit eadbd14

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ jobs:
5050
uses: actions/upload-artifact@v4
5151
with:
5252
name: app
53-
path: hviewer-debug.apk
53+
path: hviewer-debug.apk

.github/workflows/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,26 @@ jobs:
7373
hviewer-${{ github.ref_name }}-x86_64-release.apk
7474
fail_on_unmatched_files: true
7575
make_latest: true
76+
77+
- name: Send APK links to Telegram
78+
env:
79+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
80+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
81+
VERSION: ${{ github.ref_name }}
82+
run: |
83+
repo_url=$(git remote get-url origin)
84+
username=$(echo "$repo_url" | sed -E 's#.*github.com[:/](.*)/(.*).git#\1#')
85+
repo_name=$(echo "$repo_url" | sed -E 's#.*github.com[:/](.*)/(.*).git#\2#')
86+
architectures=("arm64-v8a" "armeabi-v7a" "universal" "x86" "x86_64")
87+
88+
MESSAGE="🚀 *New Release Available! $$VERSION*\n\n"
89+
90+
for arch in "${architectures[@]}"; do
91+
name="hviewer-$VERSION-$arch-release.apk"
92+
MESSAGE+="🔹 [$name](https://github.com/$username/$repo_name/releases/latest/download/$name)\n"
93+
done
94+
95+
curl -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
96+
-d "chat_id=$TELEGRAM_CHAT_ID" \
97+
-d "parse_mode=Markdown" \
98+
-d "text=$MESSAGE"

0 commit comments

Comments
 (0)