mirror of
https://github.com/QM4RS/FridaBox.git
synced 2026-09-29 04:22:27 +02:00
120 lines
4.8 KiB
YAML
120 lines
4.8 KiB
YAML
name: Build and Send APK to Telegram
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-send:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '21'
|
|
cache: 'gradle'
|
|
|
|
- name: Set up Android SDK
|
|
uses: android-actions/setup-android@v3
|
|
|
|
- name: Accept Android SDK licenses
|
|
run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses || yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses || true
|
|
|
|
- name: Grant execute permission for gradlew
|
|
run: chmod +x ./gradlew
|
|
|
|
- name: Build APKs and AARs
|
|
run: ./gradlew assembleDebug assembleRelease :Bcore:assembleDebug :Bcore:assembleRelease
|
|
|
|
- name: Find Bcore AAR paths
|
|
id: aar_paths
|
|
run: |
|
|
DEBUG_AAR=$(find ./Bcore/build/outputs/aar -name "*debug.aar" | head -n 1)
|
|
RELEASE_AAR=$(find ./Bcore/build/outputs/aar -name "*release.aar" | head -n 1)
|
|
echo "debug_aar_path=$DEBUG_AAR" >> $GITHUB_OUTPUT
|
|
echo "release_aar_path=$RELEASE_AAR" >> $GITHUB_OUTPUT
|
|
|
|
- name: Send Bcore Debug AAR to Telegram and Pin
|
|
run: |
|
|
COMMIT_MSG=$(git log -1 --pretty=%s)
|
|
AAR_PATH="${{ steps.aar_paths.outputs.debug_aar_path }}"
|
|
if [ -n "$AAR_PATH" ] && [ -f "$AAR_PATH" ]; then
|
|
RESPONSE=$(curl -s -F document=@"$AAR_PATH" \
|
|
-F chat_id="$TELEGRAM_CHAT_ID" \
|
|
-F caption="[Bcore DEBUG AAR] $COMMIT_MSG" \
|
|
https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument)
|
|
MESSAGE_ID=$(echo $RESPONSE | jq '.result.message_id')
|
|
if [ "$MESSAGE_ID" != "null" ] && [ -n "$MESSAGE_ID" ]; then
|
|
curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/pinChatMessage" \
|
|
-d chat_id="$TELEGRAM_CHAT_ID" \
|
|
-d message_id="$MESSAGE_ID"
|
|
fi
|
|
else
|
|
echo "Debug AAR not found at $AAR_PATH"
|
|
fi
|
|
|
|
- name: Send Bcore Release AAR to Telegram and Pin
|
|
run: |
|
|
COMMIT_MSG=$(git log -1 --pretty=%s)
|
|
AAR_PATH="${{ steps.aar_paths.outputs.release_aar_path }}"
|
|
if [ -n "$AAR_PATH" ] && [ -f "$AAR_PATH" ]; then
|
|
RESPONSE=$(curl -s -F document=@"$AAR_PATH" \
|
|
-F chat_id="$TELEGRAM_CHAT_ID" \
|
|
-F caption="[Bcore RELEASE AAR] $COMMIT_MSG" \
|
|
https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument)
|
|
MESSAGE_ID=$(echo $RESPONSE | jq '.result.message_id')
|
|
if [ "$MESSAGE_ID" != "null" ] && [ -n "$MESSAGE_ID" ]; then
|
|
curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/pinChatMessage" \
|
|
-d chat_id="$TELEGRAM_CHAT_ID" \
|
|
-d message_id="$MESSAGE_ID"
|
|
fi
|
|
else
|
|
echo "Release AAR not found at $AAR_PATH"
|
|
fi
|
|
|
|
- name: Send ALL Debug APKs to Telegram and Pin
|
|
run: |
|
|
COMMIT_MSG=$(git log -1 --pretty=%s)
|
|
for APK in ./app/build/outputs/apk/debug/*.apk; do
|
|
if [ -f "$APK" ]; then
|
|
RESPONSE=$(curl -s -F document=@"$APK" \
|
|
-F chat_id="$TELEGRAM_CHAT_ID" \
|
|
-F caption="[DEBUG] $(basename $APK) $COMMIT_MSG" \
|
|
https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument)
|
|
MESSAGE_ID=$(echo $RESPONSE | jq '.result.message_id')
|
|
if [ "$MESSAGE_ID" != "null" ] && [ -n "$MESSAGE_ID" ]; then
|
|
curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/pinChatMessage" \
|
|
-d chat_id="$TELEGRAM_CHAT_ID" \
|
|
-d message_id="$MESSAGE_ID"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
- name: Send ALL Release APKs to Telegram and Pin
|
|
run: |
|
|
COMMIT_MSG=$(git log -1 --pretty=%s)
|
|
for APK in ./app/build/outputs/apk/release/*.apk; do
|
|
if [ -f "$APK" ]; then
|
|
RESPONSE=$(curl -s -F document=@"$APK" \
|
|
-F chat_id="$TELEGRAM_CHAT_ID" \
|
|
-F caption="[RELEASE] $(basename $APK) $COMMIT_MSG" \
|
|
https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument)
|
|
MESSAGE_ID=$(echo $RESPONSE | jq '.result.message_id')
|
|
if [ "$MESSAGE_ID" != "null" ] && [ -n "$MESSAGE_ID" ]; then
|
|
curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/pinChatMessage" \
|
|
-d chat_id="$TELEGRAM_CHAT_ID" \
|
|
-d message_id="$MESSAGE_ID"
|
|
fi
|
|
fi
|
|
done
|
|
|