diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 3c2eb34..f458044 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -50,4 +50,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: app - path: hviewer-debug.apk \ No newline at end of file + path: hviewer-debug.apk diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c2a225d..caeebaa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,3 +73,26 @@ jobs: hviewer-${{ github.ref_name }}-x86_64-release.apk fail_on_unmatched_files: true make_latest: true + + - name: Send APK links to Telegram + env: + TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} + TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} + VERSION: ${{ github.ref_name }} + run: | + repo_url=$(git remote get-url origin) + username=$(echo "$repo_url" | sed -E 's#.*github.com[:/](.*)/(.*).git#\1#') + repo_name=$(echo "$repo_url" | sed -E 's#.*github.com[:/](.*)/(.*).git#\2#') + architectures=("arm64-v8a" "armeabi-v7a" "universal" "x86" "x86_64") + + MESSAGE="🚀 *New Release Available! $$VERSION*\n\n" + + for arch in "${architectures[@]}"; do + name="hviewer-$VERSION-$arch-release.apk" + MESSAGE+="🔹 [$name](https://github.com/$username/$repo_name/releases/latest/download/$name)\n" + done + + curl -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \ + -d "chat_id=$TELEGRAM_CHAT_ID" \ + -d "parse_mode=Markdown" \ + -d "text=$MESSAGE"