diff --git a/.github/workflows/build_and_telegram.yml b/.github/workflows/build_and_telegram.yml index 36f2cdc..dd29aaf 100644 --- a/.github/workflows/build_and_telegram.yml +++ b/.github/workflows/build_and_telegram.yml @@ -14,16 +14,14 @@ jobs: TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK 21 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - - - name: Install jq - run: sudo apt-get update && sudo apt-get install -y jq + cache: 'gradle' - name: Set up Android SDK uses: android-actions/setup-android@v3 @@ -34,23 +32,8 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x ./gradlew - - name: Build Debug APK - run: ./gradlew assembleDebug - - - name: Build Release APK - run: ./gradlew assembleRelease - - - name: Build Bcore AAR - run: ./gradlew :Bcore:assembleRelease - - - name: Build Bcore Debug AAR - run: ./gradlew :Bcore:assembleDebug - - - name: Find Bcore AAR path - id: aar_path - run: | - AAR=$(find ./Bcore/build/outputs/aar -name "*.aar" | head -n 1) - echo "aar_path=$AAR" >> $GITHUB_OUTPUT + - name: Build APKs and AARs + run: ./gradlew assembleDebug assembleRelease :Bcore:assembleDebug :Bcore:assembleRelease - name: Find Bcore AAR paths id: aar_paths @@ -61,74 +44,76 @@ jobs: echo "release_aar_path=$RELEASE_AAR" >> $GITHUB_OUTPUT - name: Send Bcore Debug AAR to Telegram and Pin - env: - TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} - TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} run: | - COMMIT_MSG=$(git log -1 --pretty=%B) - RESPONSE=$(curl -s -F document=@"${{ steps.aar_paths.outputs.debug_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') - curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/pinChatMessage" \ - -d chat_id="$TELEGRAM_CHAT_ID" \ - -d message_id="$MESSAGE_ID" - - - name: Send Bcore Release AAR to Telegram and Pin - env: - TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} - TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} - run: | - COMMIT_MSG=$(git log -1 --pretty=%B) - RESPONSE=$(curl -s -F document=@"${{ steps.aar_paths.outputs.release_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') - curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/pinChatMessage" \ - -d chat_id="$TELEGRAM_CHAT_ID" \ - -d message_id="$MESSAGE_ID" - - - name: Find APK paths - id: apk_paths - run: | - DEBUG_APK=$(find ./app/build/outputs/apk/debug -name "*.apk" | head -n 1) - RELEASE_APK=$(find ./app/build/outputs/apk/release -name "*.apk" | head -n 1) - echo "debug_apk_path=$DEBUG_APK" >> $GITHUB_OUTPUT - echo "release_apk_path=$RELEASE_APK" >> $GITHUB_OUTPUT - - - name: Send ALL Debug APKs to Telegram and Pin - env: - TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} - TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} - run: | - COMMIT_MSG=$(git log -1 --pretty=%B) - for APK in ./app/build/outputs/apk/debug/*.apk; do - RESPONSE=$(curl -s -F document=@"$APK" \ + 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="[DEBUG] $(basename $APK) $COMMIT_MSG" \ + -F caption="[Bcore DEBUG AAR] $COMMIT_MSG" \ https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument) MESSAGE_ID=$(echo $RESPONSE | jq '.result.message_id') - curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/pinChatMessage" \ - -d chat_id="$TELEGRAM_CHAT_ID" \ - -d message_id="$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 - env: - TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} - TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} run: | - COMMIT_MSG=$(git log -1 --pretty=%B) + COMMIT_MSG=$(git log -1 --pretty=%s) for APK in ./app/build/outputs/apk/release/*.apk; do - 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') - curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/pinChatMessage" \ - -d chat_id="$TELEGRAM_CHAT_ID" \ - -d message_id="$MESSAGE_ID" + 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 diff --git a/.gitignore b/.gitignore index 43fcf7b..0d8cd69 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ *.iml *.idea .gradle +.kotlin/* +/.kotlin /logs/ /local.properties /inspiration +/.idea/* /.idea/caches /.idea/libraries /.idea/modules.xml