| 5 |
| - NextAlone |
| 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 | - name: FFmpeg Cache |
| 38 | id: cache |
| 39 | uses: actions/cache@v2 |
| 40 | with: |
| 41 | path: | |
| 42 | TMessagesProj/jni/ffmpeg/build |
| 43 | TMessagesProj/jni/libvpx/build |
| 44 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 45 | - name: Setup Android SDK Tools |
| 46 | uses: android-actions/setup-android@v2 |
| 47 | if: steps.cache.outputs.cache-hit != 'true' |
| 48 | - name: Install NDK |
| 49 | if: steps.cache.outputs.cache-hit != 'true' |
| 50 | run: | |
| 51 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 52 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 53 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 54 | - name: Native Build |
| 55 | if: steps.cache.outputs.cache-hit != 'true' |
| 56 | run: | |
| 57 | sudo apt-get install yasm -y |
| 58 | ./run init libs libvpx |
| 59 | ./run init libs ffmpeg |
| 60 | boringssl: |
| 61 | name: Native Build (BoringSSL) |
| 62 | runs-on: ubuntu-latest |
| 63 | needs: check |
| 64 | steps: |
| 65 | - name: Checkout |
| 66 | uses: actions/checkout@v2 |
| 67 | - name: Fetch Status |
| 68 | run: | |
| 69 | sed -i 's/\/\///g' settings.gradle |
| 70 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 71 | - name: BoringSSL Cache |
| 72 | id: cache |
| 73 | uses: actions/cache@v2 |
| 74 | with: |
| 75 | path: | |
| 76 | TMessagesProj/jni/boringssl/build |
| 77 | key: ${{ hashFiles('boringssl_status') }} |
| 78 | - name: Setup Android SDK Tools |
| 79 | uses: android-actions/setup-android@v2 |
| 80 | if: steps.cache.outputs.cache-hit != 'true' |
| 81 | - name: Install NDK |
| 82 | if: steps.cache.outputs.cache-hit != 'true' |
| 83 | run: | |
| 84 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 85 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 86 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 87 | - name: Native Build |
| 88 | if: steps.cache.outputs.cache-hit != 'true' |
| 89 | run: | |
| 90 | ./run init action boringssl |
| 91 | ./run init libs boringssl |
| 92 | native: |
| 93 | name: Native Build (Telegram) |
| 94 | runs-on: ubuntu-latest |
| 95 | needs: |
| 96 | - ffmpeg |
| 97 | - boringssl |
| 98 | strategy: |
| 99 | matrix: |
| 100 | flavor: |
| 101 | - armeabi-v7a |
| 102 | - arm64-v8a |
| 103 | - x86 |
| 104 | - x86_64 |
| 105 | steps: |
| 106 | - name: Checkout |
| 107 | uses: actions/checkout@v2 |
| 108 | - name: Fetch Status |
| 109 | run: | |
| 110 | sed -i 's/\/\///g' settings.gradle |
| 111 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 112 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 113 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 114 | - name: Native Cache |
| 115 | id: cache |
| 116 | uses: actions/cache@v2 |
| 117 | with: |
| 118 | path: | |
| 119 | TMessagesProj/src/main/libs |
| 120 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 121 | - name: Checkout Library |
| 122 | if: steps.cache.outputs.cache-hit != 'true' |
| 123 | run: | |
| 124 | git submodule update --init 'TMessagesProj/jni/*' |
| 125 | - name: FFmpeg Cache |
| 126 | uses: actions/cache@v2 |
| 127 | if: steps.cache.outputs.cache-hit != 'true' |
| 128 | with: |
| 129 | path: | |
| 130 | TMessagesProj/jni/ffmpeg/build |
| 131 | TMessagesProj/jni/libvpx/build |
| 132 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 133 | - name: BoringSSL Cache |
| 134 | uses: actions/cache@v2 |
| 135 | if: steps.cache.outputs.cache-hit != 'true' |
| 136 | with: |
| 137 | path: | |
| 138 | TMessagesProj/jni/boringssl/build |
| 139 | key: ${{ hashFiles('boringssl_status') }} |
| 140 | - name: Setup Android SDK Tools |
| 141 | uses: android-actions/setup-android@v2 |
| 142 | if: steps.cache.outputs.cache-hit != 'true' |
| 143 | - name: Install NDK |
| 144 | if: steps.cache.outputs.cache-hit != 'true' |
| 145 | run: | |
| 146 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 147 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 148 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 149 | - name: Fix BoringSSL |
| 150 | if: steps.cache.outputs.cache-hit != 'true' |
| 151 | run: | |
| 152 | cd TMessagesProj/jni |
| 153 | ./patch_boringssl.sh |
| 154 | - name: Native Build |
| 155 | if: steps.cache.outputs.cache-hit != 'true' |
| 156 | run: | |
| 157 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 158 | ./run libs native |
| 159 | v2ray: |
| 160 | name: Native Build (V2ray) |
| 161 | runs-on: ubuntu-latest |
| 162 | needs: check |
| 163 | steps: |
| 164 | - name: Checkout |
| 165 | uses: actions/checkout@v2 |
| 166 | - name: Fetch Status |
| 167 | run: | |
| 168 | sed -i 's/\/\///g' settings.gradle |
| 169 | git submodule status v2ray > v2ray_status |
| 170 | - name: V2ray Cache |
| 171 | id: cache |
| 172 | uses: actions/cache@v2 |
| 173 | with: |
| 174 | path: | |
| 175 | TMessagesProj/libs/libv2ray.aar |
| 176 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 177 | - name: Setup Android SDK Tools |
| 178 | uses: android-actions/setup-android@v2 |
| 179 | if: steps.cache.outputs.cache-hit != 'true' |
| 180 | - name: Install NDK |
| 181 | if: steps.cache.outputs.cache-hit != 'true' |
| 182 | run: | |
| 183 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 184 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 185 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 186 | - name: Install Golang |
| 187 | uses: actions/setup-go@v2 |
| 188 | if: steps.cache.outputs.cache-hit != 'true' |
| 189 | with: |
| 190 | go-version: 1.16 |
| 191 | - name: Native Build |
| 192 | if: steps.cache.outputs.cache-hit != 'true' |
| 193 | run: ./run libs v2ray |
| 194 | shadowsocks: |
| 195 | name: Native Build (Shadowsocks) |
| 196 | runs-on: ubuntu-latest |
| 197 | needs: check |
| 198 | steps: |
| 199 | - name: Checkout |
| 200 | uses: actions/checkout@v2 |
| 201 | - name: Fetch Status |
| 202 | run: | |
| 203 | sed -i 's/\/\///g' settings.gradle |
| 204 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 205 | - name: Shadowsocks Cache |
| 206 | id: cache |
| 207 | uses: actions/cache@v2 |
| 208 | with: |
| 209 | path: | |
| 210 | TMessagesProj/libs/ss-rust-release.aar |
| 211 | key: ${{ hashFiles('shadowsocks_status') }} |
| 212 | - name: Setup Android SDK Tools |
| 213 | uses: android-actions/setup-android@v2 |
| 214 | if: steps.cache.outputs.cache-hit != 'true' |
| 215 | - name: Install NDK |
| 216 | if: steps.cache.outputs.cache-hit != 'true' |
| 217 | run: | |
| 218 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 219 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 220 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 221 | - name: Install Rust |
| 222 | if: steps.cache.outputs.cache-hit != 'true' |
| 223 | run: ./run init action shadowsocks |
| 224 | - name: Native Build |
| 225 | if: steps.cache.outputs.cache-hit != 'true' |
| 226 | run: ./run libs shadowsocks |
| 227 | shadowsocksr: |
| 228 | name: Native Build (ShadowsocksR) |
| 229 | runs-on: ubuntu-latest |
| 230 | needs: check |
| 231 | steps: |
| 232 | - name: Checkout |
| 233 | uses: actions/checkout@v2 |
| 234 | - name: Fetch Status |
| 235 | run: | |
| 236 | sed -i 's/\/\///g' settings.gradle |
| 237 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 238 | - name: ShadowsocksR Cache |
| 239 | id: cache |
| 240 | uses: actions/cache@v2 |
| 241 | with: |
| 242 | path: | |
| 243 | TMessagesProj/libs/ssr-libev-release.aar |
| 244 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 245 | - name: Setup Android SDK Tools |
| 246 | uses: android-actions/setup-android@v2 |
| 247 | if: steps.cache.outputs.cache-hit != 'true' |
| 248 | - name: Install NDK |
| 249 | if: steps.cache.outputs.cache-hit != 'true' |
| 250 | run: | |
| 251 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 252 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 253 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 254 | - name: Native Build |
| 255 | if: steps.cache.outputs.cache-hit != 'true' |
| 256 | run: ./run libs ssr |
| 257 | build: |
| 258 | name: Gradle Build |
| 259 | runs-on: ubuntu-latest |
| 260 | needs: |
| 261 | - native |
| 262 | - v2ray |
| 263 | - shadowsocks |
| 264 | - shadowsocksr |
| 265 | strategy: |
| 266 | matrix: |
| 267 | flavor: |
| 268 | - FullRelease |
| 269 | - MiniRelease |
| 270 | steps: |
| 271 | - name: Checkout |
| 272 | uses: actions/checkout@v2 |
| 273 | - name: Setup Android SDK Tools |
| 274 | uses: android-actions/setup-android@v2 |
| 275 | - name: Fetch Status |
| 276 | run: | |
| 277 | sed -i 's/\/\///g' settings.gradle |
| 278 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 279 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 280 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 281 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 282 | git submodule status v2ray > v2ray_status |
| 283 | - name: Native Cache (armeabi-v7a) |
| 284 | uses: actions/cache@v2 |
| 285 | with: |
| 286 | path: | |
| 287 | TMessagesProj/src/main/libs |
| 288 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 289 | - name: Native Cache (arm64-v8a) |
| 290 | uses: actions/cache@v2 |
| 291 | with: |
| 292 | path: | |
| 293 | TMessagesProj/src/main/libs |
| 294 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 295 | - name: Native Cache (x86) |
| 296 | uses: actions/cache@v2 |
| 297 | with: |
| 298 | path: | |
| 299 | TMessagesProj/src/main/libs |
| 300 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-x86 |
| 301 | - name: Native Cache (x86_64) |
| 302 | uses: actions/cache@v2 |
| 303 | with: |
| 304 | path: | |
| 305 | TMessagesProj/src/main/libs |
| 306 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-x86_64 |
| 307 | - name: V2ray Cache |
| 308 | uses: actions/cache@v2 |
| 309 | with: |
| 310 | path: | |
| 311 | TMessagesProj/libs/libv2ray.aar |
| 312 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 313 | - name: Shadowsocks Cache |
| 314 | uses: actions/cache@v2 |
| 315 | with: |
| 316 | path: | |
| 317 | TMessagesProj/libs/ss-rust-release.aar |
| 318 | key: ${{ hashFiles('shadowsocks_status') }} |
| 319 | - name: ShadowsocksR Cache |
| 320 | uses: actions/cache@v2 |
| 321 | with: |
| 322 | path: | |
| 323 | TMessagesProj/libs/ssr-libev-release.aar |
| 324 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 325 | - name: Fix Gradle Memoery |
| 326 | run: | |
| 327 | sed -i -e "s/16384/6144/g" gradle.properties |
| 328 | echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" > local.properties |
| 329 | - name: Gradle cache |
| 330 | uses: actions/cache@v2 |
| 331 | with: |
| 332 | path: ~/.gradle |
| 333 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 334 | - name: Release Build |
| 335 | run: | |
| 336 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 337 | ./gradlew TMessagesProj:assemble${{ matrix.flavor }} |
| 338 |
| 339 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 340 | APK=$(dirname $APK) |
| 341 | echo "APK=$APK" >> $GITHUB_ENV |
| 342 | - uses: actions/upload-artifact@v2 |
| 343 | with: |
| 344 | name: ${{ matrix.flavor }} |
| 345 | path: ${{ env.APK }} |
| 346 | upload: |
| 347 | name: Upload Release |
| 348 | if: github.event.inputs.upload != 'y' |
| 349 | runs-on: ubuntu-latest |
| 350 | needs: |
| 351 | - build |
| 352 | - telegram-bot-api |
| 353 | steps: |
| 354 | - name: Donwload Artifacts |
| 355 | uses: actions/download-artifact@v2 |
| 356 | with: |
| 357 | path: artifacts |
| 358 | - name: Download Telegram Bot API Binary |
| 359 | uses: actions/download-artifact@master |
| 360 | with: |
| 361 | name: telegram-bot-api-binary |
| 362 | path: . |
| 363 | - name: Release |
| 364 | run: | |
| 365 | chmod +x telegram-bot-api-binary |
| 366 | ./telegram-bot-api-binary --api-id=11535358 --api-hash=33d372962fadb01df47e6ceed4e33cd6 --local 2>&1 > /dev/null & |
| 367 | curl http://127.0.0.1:8081/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage \ |
| 368 | -X POST \ |
| 369 | -F chat_id="${{ secrets.TELEGRAM_CHANNEL }}" \ |
| 370 | -F text="==== Release ====" \ |
| 371 | --silent --show-error --fail >/dev/null |
| 372 |
| 373 | # send media group via telegram bot api |
| 374 | export mini64=$(find artifacts -name "*mini-arm64-v8a-release.apk") |
| 375 | export mini32=$(find artifacts -name "*mini-armeabi-v7a-release.apk") |
| 376 | export full64=$(find artifacts -name "*full-arm64-v8a-release.apk") |
| 377 | export full32=$(find artifacts -name "*full-armeabi-v7a-release.apk") |
| 378 |
| 379 | curl -v "http://127.0.0.1:8081/bot${{ secrets.TELEGRAM_TOKEN }}/sendMediaGroup?chat_id=${{ secrets.TELEGRAM_CHANNEL }}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fmini64%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fmini32%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Ffull64%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Ffull32%22%7D%5D" \ |
| 380 | -F mini64="@$mini64" \ |
| 381 | -F mini32="@$mini32" \ |
| 382 | -F full64="@$full64" \ |
| 383 | -F full32="@$full32" \ |
| 384 | --retry 5 \ |
| 385 | --retry-delay 5 \ |
| 386 | --silent --show-error --fail >/dev/null |
| 387 |
| 388 | pkill telegram-bot |
| 389 | telegram-bot-api: |
| 390 | name: Telegram Bot API |
| 391 | runs-on: ubuntu-latest |
| 392 | steps: |
| 393 | - name: Checkout |
| 394 | uses: actions/checkout@v2 |
| 395 | - name: Clone Telegram Bot API |
| 396 | run: | |
| 397 | git clone --recursive https://github.com/tdlib/telegram-bot-api.git |
| 398 | git status telegram-bot-api >> telegram-bot-api-status |
| 399 | - name: Cache Bot API Binary |
| 400 | id: cache-bot-api |
| 401 | uses: actions/cache@v2 |
| 402 | with: |
| 403 | path: telegram-bot-api-binary |
| 404 | key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }} |
| 405 | - name: Compile Telegram Bot API |
| 406 | if: steps.cache-bot-api.outputs.cache-hit != 'true' |
| 407 | run: | |
| 408 | sudo apt-get update |
| 409 | sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++ |
| 410 | cd telegram-bot-api |
| 411 | rm -rf build |
| 412 | mkdir build |
| 413 | cd build |
| 414 | cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. |
| 415 | cmake --build . --target install -j$(nproc) |
| 416 | cd ../.. |
| 417 | ls -l telegram-bot-api/bin/telegram-bot-api* |
| 418 | cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary |
| 419 | - name: Upload Binary |
| 420 | uses: actions/upload-artifact@master |
| 421 | with: |
| 422 | name: telegram-bot-api-binary |
| 423 | path: telegram-bot-api-binary |
| 424 |