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