| 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: Setup Android SDK Tools |
| 47 | uses: android-actions/setup-android@v2 |
| 48 | if: steps.cache.outputs.cache-hit != 'true' |
| 49 | - name: Install NDK |
| 50 | if: steps.cache.outputs.cache-hit != 'true' |
| 51 | run: | |
| 52 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 53 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 54 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 55 | - name: Native Build |
| 56 | if: steps.cache.outputs.cache-hit != 'true' |
| 57 | run: | |
| 58 | sudo apt-get install yasm -y |
| 59 | ./run init libs libvpx |
| 60 | ./run init libs ffmpeg |
| 61 | boringssl: |
| 62 | name: Native Build (BoringSSL) |
| 63 | runs-on: ubuntu-latest |
| 64 | needs: check |
| 65 | steps: |
| 66 | - name: Checkout |
| 67 | uses: actions/checkout@v2 |
| 68 | - name: Fetch Status |
| 69 | run: | |
| 70 | sed -i 's/\/\///g' settings.gradle |
| 71 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 72 | - name: BoringSSL Cache |
| 73 | id: cache |
| 74 | uses: actions/cache@v2 |
| 75 | with: |
| 76 | path: | |
| 77 | TMessagesProj/jni/boringssl/build |
| 78 | key: ${{ hashFiles('boringssl_status') }} |
| 79 | - name: Setup Android SDK Tools |
| 80 | uses: android-actions/setup-android@v2 |
| 81 | if: steps.cache.outputs.cache-hit != 'true' |
| 82 | - name: Install NDK |
| 83 | if: steps.cache.outputs.cache-hit != 'true' |
| 84 | run: | |
| 85 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 86 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 87 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 88 | - name: Native Build |
| 89 | if: steps.cache.outputs.cache-hit != 'true' |
| 90 | run: | |
| 91 | ./run init action boringssl |
| 92 | ./run init libs boringssl |
| 93 | native: |
| 94 | name: Native Build (Telegram) |
| 95 | runs-on: ubuntu-latest |
| 96 | needs: |
| 97 | - ffmpeg |
| 98 | - boringssl |
| 99 | strategy: |
| 100 | matrix: |
| 101 | flavor: |
| 102 | - armeabi-v7a |
| 103 | - arm64-v8a |
| 104 | steps: |
| 105 | - name: Checkout |
| 106 | uses: actions/checkout@v2 |
| 107 | - name: Fetch Status |
| 108 | run: | |
| 109 | sed -i 's/\/\///g' settings.gradle |
| 110 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 111 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 112 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 113 | - name: Native Cache |
| 114 | id: cache |
| 115 | uses: actions/cache@v2 |
| 116 | with: |
| 117 | path: | |
| 118 | TMessagesProj/src/main/libs |
| 119 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 120 | - name: Checkout Library |
| 121 | if: steps.cache.outputs.cache-hit != 'true' |
| 122 | run: | |
| 123 | git submodule update --init 'TMessagesProj/jni/*' |
| 124 | - name: FFmpeg Cache |
| 125 | uses: actions/cache@v2 |
| 126 | if: steps.cache.outputs.cache-hit != 'true' |
| 127 | with: |
| 128 | path: | |
| 129 | TMessagesProj/jni/ffmpeg/build |
| 130 | TMessagesProj/jni/libvpx/build |
| 131 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 132 | - name: BoringSSL Cache |
| 133 | uses: actions/cache@v2 |
| 134 | if: steps.cache.outputs.cache-hit != 'true' |
| 135 | with: |
| 136 | path: | |
| 137 | TMessagesProj/jni/boringssl/build |
| 138 | key: ${{ hashFiles('boringssl_status') }} |
| 139 | - name: Setup Android SDK Tools |
| 140 | uses: android-actions/setup-android@v2 |
| 141 | if: steps.cache.outputs.cache-hit != 'true' |
| 142 | - name: Install NDK |
| 143 | if: steps.cache.outputs.cache-hit != 'true' |
| 144 | run: | |
| 145 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 146 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 147 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 148 | - name: Fix BoringSSL |
| 149 | if: steps.cache.outputs.cache-hit != 'true' |
| 150 | run: | |
| 151 | cd TMessagesProj/jni |
| 152 | ./patch_boringssl.sh |
| 153 | - name: Native Build |
| 154 | if: steps.cache.outputs.cache-hit != 'true' |
| 155 | run: | |
| 156 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 157 | ./run libs native |
| 158 | v2ray: |
| 159 | name: Native Build (V2ray) |
| 160 | runs-on: ubuntu-latest |
| 161 | needs: check |
| 162 | steps: |
| 163 | - name: Checkout |
| 164 | uses: actions/checkout@v2 |
| 165 | - name: Fetch Status |
| 166 | run: | |
| 167 | sed -i 's/\/\///g' settings.gradle |
| 168 | git submodule status v2ray > v2ray_status |
| 169 | - name: V2ray Cache |
| 170 | id: cache |
| 171 | uses: actions/cache@v2 |
| 172 | with: |
| 173 | path: | |
| 174 | TMessagesProj/libs/libv2ray.aar |
| 175 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 176 | - name: Setup Android SDK Tools |
| 177 | uses: android-actions/setup-android@v2 |
| 178 | if: steps.cache.outputs.cache-hit != 'true' |
| 179 | - name: Install NDK |
| 180 | if: steps.cache.outputs.cache-hit != 'true' |
| 181 | run: | |
| 182 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 183 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 184 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 185 | - name: Install Golang |
| 186 | uses: actions/setup-go@v4 |
| 187 | if: steps.cache.outputs.cache-hit != 'true' |
| 188 | with: |
| 189 | go-version: 1.16 |
| 190 | - name: Native Build |
| 191 | if: steps.cache.outputs.cache-hit != 'true' |
| 192 | run: ./run libs v2ray |
| 193 | shadowsocks: |
| 194 | name: Native Build (Shadowsocks) |
| 195 | runs-on: ubuntu-latest |
| 196 | needs: check |
| 197 | steps: |
| 198 | - name: Checkout |
| 199 | uses: actions/checkout@v2 |
| 200 | - name: Fetch Status |
| 201 | run: | |
| 202 | sed -i 's/\/\///g' settings.gradle |
| 203 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 204 | - name: Shadowsocks Cache |
| 205 | id: cache |
| 206 | uses: actions/cache@v2 |
| 207 | with: |
| 208 | path: | |
| 209 | TMessagesProj/libs/ss-rust-release.aar |
| 210 | key: ${{ hashFiles('shadowsocks_status') }} |
| 211 | - name: Setup Android SDK Tools |
| 212 | uses: android-actions/setup-android@v2 |
| 213 | if: steps.cache.outputs.cache-hit != 'true' |
| 214 | - name: Install NDK |
| 215 | if: steps.cache.outputs.cache-hit != 'true' |
| 216 | run: | |
| 217 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 218 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 219 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 220 | - name: Install Rust |
| 221 | if: steps.cache.outputs.cache-hit != 'true' |
| 222 | run: ./run init action shadowsocks |
| 223 | - name: Native Build |
| 224 | if: steps.cache.outputs.cache-hit != 'true' |
| 225 | run: ./run libs shadowsocks |
| 226 | shadowsocksr: |
| 227 | name: Native Build (ShadowsocksR) |
| 228 | runs-on: ubuntu-latest |
| 229 | needs: check |
| 230 | steps: |
| 231 | - name: Checkout |
| 232 | uses: actions/checkout@v2 |
| 233 | - name: Fetch Status |
| 234 | run: | |
| 235 | sed -i 's/\/\///g' settings.gradle |
| 236 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 237 | - name: ShadowsocksR Cache |
| 238 | id: cache |
| 239 | uses: actions/cache@v2 |
| 240 | with: |
| 241 | path: | |
| 242 | TMessagesProj/libs/ssr-libev-release.aar |
| 243 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 244 | - name: Setup Android SDK Tools |
| 245 | uses: android-actions/setup-android@v2 |
| 246 | if: steps.cache.outputs.cache-hit != 'true' |
| 247 | - name: Install NDK |
| 248 | if: steps.cache.outputs.cache-hit != 'true' |
| 249 | run: | |
| 250 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 251 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 252 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 253 | - name: Native Build |
| 254 | if: steps.cache.outputs.cache-hit != 'true' |
| 255 | run: ./run libs ssr |
| 256 | build: |
| 257 | name: Gradle Build |
| 258 | runs-on: ubuntu-latest |
| 259 | needs: |
| 260 | - native |
| 261 | - v2ray |
| 262 | - shadowsocks |
| 263 | - shadowsocksr |
| 264 | strategy: |
| 265 | matrix: |
| 266 | flavor: |
| 267 | # - FullRelease |
| 268 | - MiniRelease |
| 269 | # - FullReleaseNoGcm |
| 270 | - MiniReleaseNoGcm |
| 271 | steps: |
| 272 | - name: Checkout |
| 273 | uses: actions/checkout@v2 |
| 274 | - name: Setup Android SDK Tools |
| 275 | uses: android-actions/setup-android@v2 |
| 276 | - name: Install NDK |
| 277 | run: | |
| 278 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 279 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 280 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 281 | - name: Fetch Status |
| 282 | run: | |
| 283 | sed -i 's/\/\///g' settings.gradle |
| 284 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 285 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 286 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 287 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 288 | git submodule status v2ray > v2ray_status |
| 289 | - name: Native Cache (armeabi-v7a) |
| 290 | uses: actions/cache@v2 |
| 291 | with: |
| 292 | path: | |
| 293 | TMessagesProj/src/main/libs |
| 294 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 295 | - name: Native Cache (arm64-v8a) |
| 296 | uses: actions/cache@v2 |
| 297 | with: |
| 298 | path: | |
| 299 | TMessagesProj/src/main/libs |
| 300 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 301 | - name: V2ray Cache |
| 302 | uses: actions/cache@v2 |
| 303 | with: |
| 304 | path: | |
| 305 | TMessagesProj/libs/libv2ray.aar |
| 306 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 307 | - name: Shadowsocks Cache |
| 308 | uses: actions/cache@v2 |
| 309 | with: |
| 310 | path: | |
| 311 | TMessagesProj/libs/ss-rust-release.aar |
| 312 | key: ${{ hashFiles('shadowsocks_status') }} |
| 313 | - name: ShadowsocksR Cache |
| 314 | uses: actions/cache@v2 |
| 315 | with: |
| 316 | path: | |
| 317 | TMessagesProj/libs/ssr-libev-release.aar |
| 318 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 319 | - name: Configure Gradle |
| 320 | run: | |
| 321 | sed -i -e "s/16384/6144/g" gradle.properties |
| 322 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 323 | - name: Gradle cache |
| 324 | uses: actions/cache@v2 |
| 325 | with: |
| 326 | path: ~/.gradle |
| 327 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 328 | - name: Release Build |
| 329 | run: | |
| 330 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 331 | ./gradlew TMessagesProj:assemble${{ matrix.flavor }} |
| 332 |
| 333 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 334 | APK=$(dirname $APK) |
| 335 | echo "APK=$APK" >> $GITHUB_ENV |
| 336 | - uses: actions/upload-artifact@v2 |
| 337 | with: |
| 338 | name: ${{ matrix.flavor }} |
| 339 | path: ${{ env.APK }} |
| 340 | upload: |
| 341 | name: Upload release |
| 342 | if: github.event.inputs.upload != 'y' |
| 343 | runs-on: ubuntu-latest |
| 344 | needs: |
| 345 | - build |
| 346 | - telegram-bot-api |
| 347 | steps: |
| 348 | - name: Donwload Artifacts |
| 349 | uses: actions/download-artifact@v2 |
| 350 | with: |
| 351 | path: artifacts |
| 352 | - name: Download Telegram Bot API Binary |
| 353 | uses: actions/download-artifact@master |
| 354 | with: |
| 355 | name: telegram-bot-api-binary |
| 356 | path: . |
| 357 | - name: Send to Telegram |
| 358 | run: | |
| 359 | chmod +x telegram-bot-api-binary |
| 360 | function start() { |
| 361 | ./telegram-bot-api-binary --api-id=11535358 --api-hash=33d372962fadb01df47e6ceed4e33cd6 --local 2>&1 > /dev/null & |
| 362 | } |
| 363 | start |
| 364 | curl http://127.0.0.1:8081/ || start |
| 365 | curl http://127.0.0.1:8081/ || start |
| 366 | curl http://127.0.0.1:8081/ || start |
| 367 | # send release via telegram bot api |
| 368 | export mini64=$(find artifacts -name "*mini-arm64-v8a.apk") |
| 369 | export mini32=$(find artifacts -name "*mini-armeabi-v7a.apk") |
| 370 | # export full64=$(find artifacts -name "*full-arm64-v8a.apk") |
| 371 | # export full32=$(find artifacts -name "*full-armeabi-v7a.apk") |
| 372 | export mini64nogcm=$(find artifacts -name "*mini-arm64-v8aNoGcm.apk") |
| 373 | export mini32nogcm=$(find artifacts -name "*mini-armeabi-v7aNoGcm.apk") |
| 374 | # export full64nogcm=$(find artifacts -name "*full-arm64-v8aNoGcm.apk") |
| 375 | # export full32nogcm=$(find artifacts -name "*full-armeabi-v7aNoGcm.apk") |
| 376 |
| 377 | echo $mini64 |
| 378 | echo $mini32 |
| 379 | # echo $full64 |
| 380 | # echo $full32 |
| 381 | echo $mini64nogcm |
| 382 | echo $mini32nogcm |
| 383 | # echo $full64nogcm |
| 384 | # echo $full32nogcm |
| 385 |
| 386 | curl --http0.9 http://127.0.0.1:8081/bot${{ secrets.HELPER_BOT_TOKEN }}/sendMediaGroup --form-string chat_id=${{ secrets.HELPER_BOT_TARGET }} --form apk1=@"${mini64}" --form apk2=@"${mini32}" --form apk3=@"${mini64nogcm}" --form apk4=@"${mini32nogcm}" --form-string media="[{\"type\": \"document\",\"media\": \"attach://apk1\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk2\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk3\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk4\",\"caption\": \"${{ github.event.head_commit.message }}\",\"parse_mode\": \"Markdown\"}]" --verbose >/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 |