| 5 |
| - main |
| 6 | paths-ignore: |
| 7 | - '**.md' |
| 8 | - '.github/**' |
| 9 | - '!.github/workflows/release.yml' |
| 10 | workflow_dispatch: |
| 11 | inputs: |
| 12 | upload: |
| 13 | description: 'Upload: If want ignore' |
| 14 | required: false |
| 15 | jobs: |
| 16 | check: |
| 17 | name: Check Access |
| 18 | runs-on: ubuntu-latest |
| 19 | steps: |
| 20 | - name: "Check access" |
| 21 | uses: "lannonbr/repo-permission-check-action@2.0.0" |
| 22 | with: |
| 23 | permission: "write" |
| 24 | env: |
| 25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 26 | ffmpeg: |
| 27 | name: Native Build (FFmpeg) |
| 28 | runs-on: ubuntu-latest |
| 29 | needs: check |
| 30 | steps: |
| 31 | - name: Checkout |
| 32 | uses: actions/checkout@v2 |
| 33 | - name: Fetch Status |
| 34 | run: | |
| 35 | sed -i 's/\/\///g' settings.gradle |
| 36 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 37 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 38 | - name: FFmpeg Cache |
| 39 | id: cache |
| 40 | uses: actions/cache@v2 |
| 41 | with: |
| 42 | path: | |
| 43 | TMessagesProj/jni/ffmpeg/build |
| 44 | TMessagesProj/jni/libvpx/build |
| 45 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 46 | - name: Set up JDK 17 |
| 47 | uses: actions/setup-java@v3 |
| 48 | if: steps.cache.outputs.cache-hit != 'true' |
| 49 | with: |
| 50 | java-version: '17' |
| 51 | distribution: 'temurin' |
| 52 | - name: Setup Android SDK Tools |
| 53 | uses: android-actions/setup-android@v3 |
| 54 | if: steps.cache.outputs.cache-hit != 'true' |
| 55 | - name: Install NDK |
| 56 | if: steps.cache.outputs.cache-hit != 'true' |
| 57 | run: | |
| 58 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 59 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 60 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 61 | - name: Native Build |
| 62 | if: steps.cache.outputs.cache-hit != 'true' |
| 63 | run: | |
| 64 | sudo apt-get install yasm -y |
| 65 | ./run init libs libvpx |
| 66 | ./run init libs ffmpeg |
| 67 | boringssl: |
| 68 | name: Native Build (BoringSSL) |
| 69 | runs-on: ubuntu-latest |
| 70 | needs: check |
| 71 | steps: |
| 72 | - name: Checkout |
| 73 | uses: actions/checkout@v2 |
| 74 | - name: Fetch Status |
| 75 | run: | |
| 76 | sed -i 's/\/\///g' settings.gradle |
| 77 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 78 | - name: BoringSSL Cache |
| 79 | id: cache |
| 80 | uses: actions/cache@v2 |
| 81 | with: |
| 82 | path: | |
| 83 | TMessagesProj/jni/boringssl/build |
| 84 | key: ${{ hashFiles('boringssl_status') }} |
| 85 | - name: Set up JDK 17 |
| 86 | uses: actions/setup-java@v3 |
| 87 | if: steps.cache.outputs.cache-hit != 'true' |
| 88 | with: |
| 89 | java-version: '17' |
| 90 | distribution: 'temurin' |
| 91 | - name: Setup Android SDK Tools |
| 92 | uses: android-actions/setup-android@v3 |
| 93 | if: steps.cache.outputs.cache-hit != 'true' |
| 94 | - name: Install NDK |
| 95 | if: steps.cache.outputs.cache-hit != 'true' |
| 96 | run: | |
| 97 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 98 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 99 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 100 | - name: Native Build |
| 101 | if: steps.cache.outputs.cache-hit != 'true' |
| 102 | run: | |
| 103 | ./run init action boringssl |
| 104 | ./run init libs boringssl |
| 105 | native: |
| 106 | name: Native Build (Telegram) |
| 107 | runs-on: ubuntu-latest |
| 108 | needs: |
| 109 | - ffmpeg |
| 110 | - boringssl |
| 111 | strategy: |
| 112 | matrix: |
| 113 | flavor: |
| 114 | - armeabi-v7a |
| 115 | - arm64-v8a |
| 116 | steps: |
| 117 | - name: Checkout |
| 118 | uses: actions/checkout@v2 |
| 119 | - name: Fetch Status |
| 120 | run: | |
| 121 | sed -i 's/\/\///g' settings.gradle |
| 122 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 123 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 124 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 125 | - name: Native Cache |
| 126 | id: cache |
| 127 | uses: actions/cache@v2 |
| 128 | with: |
| 129 | path: | |
| 130 | TMessagesProj/src/main/libs |
| 131 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 132 | - name: Checkout Library |
| 133 | if: steps.cache.outputs.cache-hit != 'true' |
| 134 | run: | |
| 135 | git submodule update --init 'TMessagesProj/jni/*' |
| 136 | - name: FFmpeg Cache |
| 137 | uses: actions/cache@v2 |
| 138 | if: steps.cache.outputs.cache-hit != 'true' |
| 139 | with: |
| 140 | path: | |
| 141 | TMessagesProj/jni/ffmpeg/build |
| 142 | TMessagesProj/jni/libvpx/build |
| 143 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 144 | - name: BoringSSL Cache |
| 145 | uses: actions/cache@v2 |
| 146 | if: steps.cache.outputs.cache-hit != 'true' |
| 147 | with: |
| 148 | path: | |
| 149 | TMessagesProj/jni/boringssl/build |
| 150 | key: ${{ hashFiles('boringssl_status') }} |
| 151 | - name: Set up JDK 17 |
| 152 | uses: actions/setup-java@v3 |
| 153 | if: steps.cache.outputs.cache-hit != 'true' |
| 154 | with: |
| 155 | java-version: '17' |
| 156 | distribution: 'temurin' |
| 157 | - name: Setup Android SDK Tools |
| 158 | uses: android-actions/setup-android@v3 |
| 159 | if: steps.cache.outputs.cache-hit != 'true' |
| 160 | - name: Install NDK |
| 161 | if: steps.cache.outputs.cache-hit != 'true' |
| 162 | run: | |
| 163 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 164 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 165 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 166 | - name: Fix BoringSSL |
| 167 | if: steps.cache.outputs.cache-hit != 'true' |
| 168 | run: | |
| 169 | cd TMessagesProj/jni |
| 170 | ./patch_boringssl.sh |
| 171 | - name: Native Build |
| 172 | if: steps.cache.outputs.cache-hit != 'true' |
| 173 | run: | |
| 174 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 175 | ./run libs native |
| 176 | build: |
| 177 | name: Gradle Build |
| 178 | runs-on: ubuntu-latest |
| 179 | needs: |
| 180 | - native |
| 181 | steps: |
| 182 | - name: Checkout |
| 183 | uses: actions/checkout@v2 |
| 184 | - name: Set up JDK 17 |
| 185 | uses: actions/setup-java@v3 |
| 186 | with: |
| 187 | java-version: '17' |
| 188 | distribution: 'temurin' |
| 189 | - name: Setup Android SDK Tools |
| 190 | uses: android-actions/setup-android@v3 |
| 191 | - name: Install NDK |
| 192 | run: | |
| 193 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 194 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 195 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 196 | - name: Fetch Status |
| 197 | run: | |
| 198 | sed -i 's/\/\///g' settings.gradle |
| 199 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 200 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 201 | - name: Native Cache (armeabi-v7a) |
| 202 | uses: actions/cache@v2 |
| 203 | with: |
| 204 | path: | |
| 205 | TMessagesProj/src/main/libs |
| 206 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 207 | - name: Native Cache (arm64-v8a) |
| 208 | uses: actions/cache@v2 |
| 209 | with: |
| 210 | path: | |
| 211 | TMessagesProj/src/main/libs |
| 212 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 213 | - name: Configure Gradle |
| 214 | run: | |
| 215 | sed -i -e "s/16384/6144/g" gradle.properties |
| 216 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 217 | - name: Gradle cache |
| 218 | uses: actions/cache@v2 |
| 219 | with: |
| 220 | path: ~/.gradle |
| 221 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 222 | - name: Release Build |
| 223 | run: | |
| 224 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 225 | ./gradlew TMessagesProj:assembleRelease |
| 226 |
| 227 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 228 | APK=$(dirname $APK) |
| 229 | echo "APK=$APK" >> $GITHUB_ENV |
| 230 | - uses: actions/upload-artifact@v4 |
| 231 | with: |
| 232 | name: Release |
| 233 | path: ${{ env.APK }} |
| 234 | upload: |
| 235 | name: Upload release |
| 236 | if: github.event.inputs.upload != 'y' |
| 237 | runs-on: ubuntu-latest |
| 238 | needs: |
| 239 | - build |
| 240 | steps: |
| 241 | - name: Checkout |
| 242 | uses: actions/checkout@v4 |
| 243 | - name: Donwload Artifacts |
| 244 | uses: actions/download-artifact@v4 |
| 245 | with: |
| 246 | path: artifacts |
| 247 | - name: Set up Python |
| 248 | uses: actions/setup-python@v5 |
| 249 | with: |
| 250 | python-version: 3.12 |
| 251 | - name: Send to Telegram |
| 252 | run: | |
| 253 | # send release via telegram bot api |
| 254 | export mini64=$(find artifacts -name "*arm64-v8a.apk") |
| 255 | export mini32=$(find artifacts -name "*armeabi-v7a.apk") |
| 256 |
| 257 | echo $mini64 |
| 258 | echo $mini32 |
| 259 |
| 260 | python -m pip install -r bin/scripts/requirements.txt |
| 261 | git log -1 --pretty=format:"%s%n%n%b" > artifacts/caption.txt |
| 262 | python bin/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }} release |
| 263 |