diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d5c8290..e659b846 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,25 +18,15 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - submodules: 'true' - - - name: Prepare build dir - run: | - mkdir ${{ github.workspace }}/build - - - name: Fetch AndroidLibV2rayLite - run: | - cd ${{ github.workspace }}/build - git clone --depth=1 -b master https://github.com/2dust/AndroidLibV2rayLite.git - cd AndroidLibV2rayLite - git submodule update --init + submodules: 'recursive' + fetch-depth: '0' - name: Restore cached libtun2socks id: cache-libtun2socks-restore uses: actions/cache/restore@v4 with: - path: ${{ github.workspace }}/build/AndroidLibV2rayLite/libs - key: libtun2socks-${{ runner.os }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/refs/heads/master') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/badvpn/HEAD') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/libancillary/HEAD') }} + path: ${{ github.workspace }}/AndroidLibXrayLite/libs + key: libtun2socks-${{ runner.os }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/libancillary/HEAD') }} - name: Setup Android NDK uses: nttld/setup-ndk@v1 @@ -61,7 +51,7 @@ jobs: - name: Build libtun2socks if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true' run: | - cd ${{ github.workspace }}/build/AndroidLibV2rayLite + cd ${{ github.workspace }}/AndroidLibXrayLite bash compile-tun2socks.sh tar -xvzf libtun2socks.so.tgz env: @@ -71,18 +61,26 @@ jobs: if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: - path: ${{ github.workspace }}/build/AndroidLibV2rayLite/libs - key: libtun2socks-${{ runner.os }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/refs/heads/master') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/badvpn/HEAD') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/libancillary/HEAD') }} + path: ${{ github.workspace }}/AndroidLibXrayLite/libs + key: libtun2socks-${{ runner.os }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/libancillary/HEAD') }} - name: Copy libtun2socks run: | - cp -r ${{ github.workspace }}/build/AndroidLibV2rayLite/libs ${{ github.workspace }}/V2rayNG/app + cp -r ${{ github.workspace }}/AndroidLibXrayLite/libs ${{ github.workspace }}/V2rayNG/app + + - name: Fetch AndroidLibXrayLite tag + run: | + pushd AndroidLibXrayLite + CURRENT_TAG=$(git describe --tags --abbrev=0) + echo "Current tag in this repo: $CURRENT_TAG" + echo "CURRENT_TAG=$CURRENT_TAG" >> $GITHUB_ENV + popd - name: Download libv2ray uses: robinraju/release-downloader@v1 with: repository: '2dust/AndroidLibXrayLite' - latest: true + tag: ${{ env.CURRENT_TAG }} fileName: 'libv2ray.aar' out-file-path: V2rayNG/app/libs/ @@ -93,18 +91,11 @@ jobs: path: ${{ github.workspace }}/hysteria/libs key: libhysteria2-${{ runner.os }}-${{ hashFiles('.git/modules/hysteria/HEAD') }}-${{ hashFiles('libhysteria.sh') }} - - name: Fetch Go version from AndroidLibXrayLite - if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true' - run: | - GO_VERSION=$(curl -sL https://github.com/2dust/AndroidLibXrayLite/raw/refs/heads/main/go.mod | sed -n -E 's/.*go ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') - echo "Go version: $GO_VERSION" - echo "GO_VERSION=$GO_VERSION" >> $GITHUB_ENV - - name: Setup Golang if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true' uses: actions/setup-go@v5 with: - go-version: '${{ env.GO_VERSION }}' + go-mod-file: 'AndroidLibXrayLite/go.mod' - name: Build libhysteria2 if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true' diff --git a/.gitmodules b/.gitmodules index b0a1e97d..5823c38a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "hysteria"] path = hysteria url = https://github.com/apernet/hysteria +[submodule "AndroidLibXrayLite"] + path = AndroidLibXrayLite + url = https://github.com/2dust/AndroidLibXrayLite diff --git a/AndroidLibXrayLite b/AndroidLibXrayLite new file mode 160000 index 00000000..664c3892 --- /dev/null +++ b/AndroidLibXrayLite @@ -0,0 +1 @@ +Subproject commit 664c3892e22aab6501f9f5c5fb5473da605528a0