| branches: |
| 6 | - dev |
| 7 | paths-ignore: |
| 8 | - '**.md' |
| 9 | - '.github/**' |
| 10 | - '!.github/workflows/debug.yml' |
| 11 |
| 12 | jobs: |
| 13 | native: |
| 14 | name: Native Build (Telegram) |
| 15 | runs-on: ubuntu-latest |
| 16 | strategy: |
| 17 | matrix: |
| 18 | flavor: |
| 19 | - armeabi-v7a |
| 20 | - arm64-v8a |
| 21 | steps: |
| 22 | - name: Checkout |
| 23 | uses: actions/checkout@v7 |
| 24 | - name: Fetch Status |
| 25 | run: | |
| 26 | sed -i 's/\/\///g' settings.gradle |
| 27 | - name: Native Cache |
| 28 | id: cache |
| 29 | uses: actions/cache@v6 |
| 30 | with: |
| 31 | path: | |
| 32 | TMessagesProj/src/main/libs |
| 33 | key: ${{ hashFiles('TMessagesProj/jni/**') }}-${{ matrix.flavor }} |
| 34 | - name: Checkout Library |
| 35 | if: steps.cache.outputs.cache-hit != 'true' |
| 36 | run: | |
| 37 | git submodule update --init |
| 38 | - name: Set up JDK 17 |
| 39 | uses: actions/setup-java@v6 |
| 40 | if: steps.cache.outputs.cache-hit != 'true' |
| 41 | with: |
| 42 | java-version: '17' |
| 43 | distribution: 'temurin' |
| 44 | - name: Setup Android SDK Tools |
| 45 | uses: android-actions/setup-android@v4 |
| 46 | if: steps.cache.outputs.cache-hit != 'true' |
| 47 | with: |
| 48 | packages: 'platform-tools' |
| 49 | - name: Install NDK |
| 50 | if: steps.cache.outputs.cache-hit != 'true' |
| 51 | run: | |
| 52 | echo "y" | sdkmanager --install "ndk;27.2.12479018" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 53 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 54 | echo "ndk.dir=${ANDROID_HOME}/ndk/27.2.12479018" >> local.properties |
| 55 | - name: Native Build |
| 56 | if: steps.cache.outputs.cache-hit != 'true' |
| 57 | run: | |
| 58 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 59 | ./run libs native |
| 60 | build: |
| 61 | name: Gradle Build |
| 62 | runs-on: ubuntu-latest |
| 63 | needs: |
| 64 | - native |
| 65 | steps: |
| 66 | - name: Checkout |
| 67 | uses: actions/checkout@v7 |
| 68 | - name: Fetch Status |
| 69 | run: | |
| 70 | sed -i 's/\/\///g' settings.gradle |
| 71 | - name: Native Cache (armeabi-v7a) |
| 72 | uses: actions/cache@v6 |
| 73 | with: |
| 74 | path: | |
| 75 | TMessagesProj/src/main/libs |
| 76 | key: ${{ hashFiles('TMessagesProj/jni/**') }}-armeabi-v7a |
| 77 | - name: Native Cache (arm64-v8a) |
| 78 | uses: actions/cache@v6 |
| 79 | with: |
| 80 | path: | |
| 81 | TMessagesProj/src/main/libs |
| 82 | key: ${{ hashFiles('TMessagesProj/jni/**') }}-arm64-v8a |
| 83 | - name: Checkout Library |
| 84 | run: | |
| 85 | git submodule update --init |
| 86 | - name: Set up JDK 17 |
| 87 | uses: actions/setup-java@v6 |
| 88 | with: |
| 89 | java-version: '17' |
| 90 | distribution: 'temurin' |
| 91 | - name: Setup Android SDK Tools |
| 92 | uses: android-actions/setup-android@v4 |
| 93 | with: |
| 94 | packages: 'platform-tools' |
| 95 | - name: Install NDK |
| 96 | run: | |
| 97 | echo "y" | sdkmanager --install "ndk;27.2.12479018" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 98 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 99 | echo "ndk.dir=${ANDROID_HOME}/ndk/27.2.12479018" >> local.properties |
| 100 | - name: Configure Gradle |
| 101 | run: | |
| 102 | sed -i "s/2000000000000/$(date +%s%N | cut -c1-13)/g" gradle.properties |
| 103 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 104 | - name: Setup Gradle |
| 105 | uses: gradle/actions/setup-gradle@v6 |
| 106 | with: |
| 107 | cache-read-only: false |
| 108 | - name: Debug Build |
| 109 | run: | |
| 110 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 111 | export SENTRY_AUTH_TOKEN="${{ secrets.SENTRY_AUTH_TOKEN }}" |
| 112 | ./gradlew TMessagesProj:assembleRelease --build-cache --no-configuration-cache |
| 113 |
| 114 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 115 | APK=$(dirname $APK) |
| 116 | echo "APK=$APK" >> $GITHUB_ENV |
| 117 | - name: Upload gradle.properties |
| 118 | uses: actions/upload-artifact@v7 |
| 119 | with: |
| 120 | name: gradle-properties |
| 121 | path: gradle.properties |
| 122 | - uses: actions/upload-artifact@v7 |
| 123 | with: |
| 124 | name: Release |
| 125 | path: ${{ env.APK }} |
| 126 | upload: |
| 127 | name: Upload debug |
| 128 | if: github.event.inputs.upload != 'y' |
| 129 | runs-on: ubuntu-latest |
| 130 | needs: |
| 131 | - build |
| 132 | steps: |
| 133 | - name: Checkout |
| 134 | uses: actions/checkout@v7 |
| 135 | - name: Remove gradle.properties |
| 136 | run: | |
| 137 | rm -f gradle.properties |
| 138 | - name: Download gradle.properties |
| 139 | uses: actions/download-artifact@v8 |
| 140 | with: |
| 141 | name: gradle-properties |
| 142 | path: . |
| 143 | - name: Donwload Artifacts |
| 144 | uses: actions/download-artifact@v8 |
| 145 | with: |
| 146 | path: artifacts |
| 147 | - name: Set up Python |
| 148 | uses: actions/setup-python@v7 |
| 149 | with: |
| 150 | python-version: 3.12 |
| 151 | - name: Send to Telegram |
| 152 | run: | |
| 153 | # send release via telegram bot api |
| 154 | export mini64=$(find artifacts -name "*arm64-v8a.apk") |
| 155 | export mini32=$(find artifacts -name "*armeabi-v7a.apk") |
| 156 |
| 157 | echo $mini64 |
| 158 | echo $mini32 |
| 159 |
| 160 | python -m pip install -r bin/scripts/requirements.txt |
| 161 | git log -1 --pretty=format:"%s%n%n%b" > artifacts/caption.txt |
| 162 | python bin/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }} test |
| 163 |