Skip to content

The only downloader you need. 下载器的集大成者。

ci(android): compose 构建接入 build.yml

XiaoYouChRe668fd77d205
diff --git a/.github/workflows/build-android-wheels.yml b/.github/workflows/build-android-wheels.yml
deleted file mode 100644
index f252b38a..00000000
--- a/.github/workflows/build-android-wheels.yml
+++ /dev/null
@@ -1,90 +0,0 @@
-name: Build Android Wheels
-
-on:
- workflow_dispatch:
-
-jobs:
- libtorrent:
- runs-on: ubuntu-24.04
- steps:
- - uses: actions/checkout@v7
-
- - uses: actions/setup-python@v7
- with:
- python-version: '3.14'
-
- - name: Install wheel tool
- run: pip install wheel
-
- - name: Build libtorrent wheel
- working-directory: compose/build-scripts
- run: ./build_libtorrent_wheel.sh --abi=arm64-v8a
-
- - uses: actions/upload-artifact@v7
- with:
- name: libtorrent-arm64-v8a
- path: compose/build-scripts/dist/libtorrent-*.whl
-
- wreq:
- runs-on: ubuntu-24.04
- steps:
- - uses: actions/checkout@v7
-
- - uses: actions/setup-python@v7
- with:
- python-version: '3.14'
-
- - name: Install tools
- run: pip install lief wheel
-
- - name: Patch wreq wheel
- working-directory: compose/build-scripts
- run: ./patch_wreq_wheel.sh --abi=arm64-v8a
-
- - uses: actions/upload-artifact@v7
- with:
- name: wreq-arm64-v8a
- path: compose/build-scripts/dist/wreq-*.whl
-
- goed2kd:
- runs-on: ubuntu-24.04
- steps:
- - uses: actions/checkout@v7
-
- - uses: actions/checkout@v7
- with:
- repository: XiaoYouChR/Python-eD2k
- path: Python-eD2k
-
- - uses: actions/setup-go@v7
- with:
- go-version-file: Python-eD2k/go.mod
-
- - name: Build goed2kd
- working-directory: compose/build-scripts
- env:
- GOED2K_SRC: ${{ github.workspace }}/Python-eD2k
- run: ./build_goed2kd.sh
-
- - uses: actions/upload-artifact@v7
- with:
- name: goed2kd-arm64-v8a
- path: compose/app/src/main/jniLibs/arm64-v8a/libgoed2kd.so
-
- native-libs:
- runs-on: ubuntu-24.04
- steps:
- - uses: actions/checkout@v7
-
- - name: Fetch pre-built binaries
- working-directory: compose/build-scripts
- run: ./fetch_android_libs.sh
-
- - uses: actions/upload-artifact@v7
- with:
- name: native-libs-arm64-v8a
- path: |
- compose/app/src/main/jniLibs/arm64-v8a/libffmpeg.so
- compose/app/src/main/jniLibs/arm64-v8a/libffprobe.so
- compose/app/src/main/jniLibs/arm64-v8a/libnm3u8dlre.so
- compose/app/src/main/jniLibs/arm64-v8a/libqjs.so
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9f7766d3..32923d2d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -46,10 +46,6 @@ on:
options:
- 'true'
- 'false'
- use_cn_mirror:
- description: 'Use CN Mirror (Android)'
- type: boolean
- default: false
permissions:
contents: write
@@ -674,48 +670,170 @@ jobs:
dist/Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}.deb
dist/Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}.AppImage
+ android-libtorrent:
+ if: ${{ github.event.inputs.build_target == 'android' || github.event.inputs.build_target == 'all' }}
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v7
+
+ - uses: actions/setup-python@v7
+ with:
+ python-version: '3.14'
+
+ - name: Install wheel tool
+ run: pip install wheel
+
+ - name: Build libtorrent wheel
+ working-directory: compose/build-scripts
+ run: ./build_libtorrent_wheel.sh --abi=arm64-v8a
+
+ - uses: actions/upload-artifact@v7
+ with:
+ name: libtorrent-arm64-v8a
+ path: compose/build-scripts/dist/libtorrent-*.whl
+
+ android-wreq:
+ if: ${{ github.event.inputs.build_target == 'android' || github.event.inputs.build_target == 'all' }}
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v7
+
+ - uses: actions/setup-python@v7
+ with:
+ python-version: '3.14'
+
+ - name: Install tools
+ run: pip install lief wheel
+
+ - name: Patch wreq wheel
+ working-directory: compose/build-scripts
+ run: ./patch_wreq_wheel.sh --abi=arm64-v8a
+
+ - uses: actions/upload-artifact@v7
+ with:
+ name: wreq-arm64-v8a
+ path: compose/build-scripts/dist/wreq-*.whl
+
+ android-goed2kd:
+ if: ${{ github.event.inputs.build_target == 'android' || github.event.inputs.build_target == 'all' }}
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v7
+
+ - uses: actions/checkout@v7
+ with:
+ repository: XiaoYouChR/Python-eD2k
+ path: Python-eD2k
+
+ - uses: actions/setup-go@v7
+ with:
+ go-version-file: Python-eD2k/go.mod
+
+ - name: Build goed2kd
+ working-directory: compose/build-scripts
+ env:
+ GOED2K_SRC: ${{ github.workspace }}/Python-eD2k
+ run: ./build_goed2kd.sh
+
+ - uses: actions/upload-artifact@v7
+ with:
+ name: goed2kd-arm64-v8a
+ path: compose/app/src/main/jniLibs/arm64-v8a/libgoed2kd.so
+
+ android-native-libs:
+ if: ${{ github.event.inputs.build_target == 'android' || github.event.inputs.build_target == 'all' }}
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v7
+
+ - name: Fetch pre-built binaries
+ working-directory: compose/build-scripts
+ run: ./fetch_android_libs.sh
+
+ - uses: actions/upload-artifact@v7
+ with:
+ name: native-libs-arm64-v8a
+ path: compose/app/src/main/jniLibs/arm64-v8a
+
build-android:
- needs: [prepare]
+ needs: [prepare, android-libtorrent, android-wreq, android-goed2kd, android-native-libs]
if: ${{ github.event.inputs.build_target == 'android' || github.event.inputs.build_target == 'all' }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 120
- env:
- GD3_CN_MIRROR: ${{ inputs.use_cn_mirror && '1' || '' }}
- GD3_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
- GD3_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
- ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Free disk space
run: |
- sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android \
+ sudo rm -rf /usr/share/dotnet /opt/ghc \
/usr/local/share/boost /usr/local/share/powershell /opt/hostedtoolcache/CodeQL \
"${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}" || true
sudo docker image prune -af || true
df -h /
+ - uses: actions/download-artifact@v8
+ with:
+ name: libtorrent-arm64-v8a
+ path: compose/build-scripts/dist
+
+ - uses: actions/download-artifact@v8
+ with:
+ name: wreq-arm64-v8a
+ path: compose/build-scripts/dist
+
+ - uses: actions/download-artifact@v8
+ with:
+ name: goed2kd-arm64-v8a
+ path: compose/app/src/main/jniLibs/arm64-v8a
+
+ - uses: actions/download-artifact@v8
+ with:
+ name: native-libs-arm64-v8a
+ path: compose/app/src/main/jniLibs/arm64-v8a
+
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '17'
+
+ - uses: actions/setup-python@v7
+ with:
+ python-version: '3.14'
+
+ - uses: gradle/actions/setup-gradle@v6
+
+ - name: Write keystore.properties
+ if: ${{ secrets.ANDROID_KEYSTORE_BASE64 != '' }}
+ env:
+ ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
+ ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
+ ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
+ run: |
+ echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"
+ cat > compose/keystore.properties <<EOF
+ storeFile=$RUNNER_TEMP/release.jks
+ storePassword=$ANDROID_KEYSTORE_PASSWORD
+ keyAlias=$ANDROID_KEY_ALIAS
+ keyPassword=$ANDROID_KEYSTORE_PASSWORD
+ EOF
+
- name: Build APK
- working-directory: android
+ working-directory: compose
+ env:
+ BUILD_PYTHON: python3.14
run: |
- if [ -n "$ANDROID_KEYSTORE_BASE64" ]; then
- echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"
- export GD3_KEYSTORE="$RUNNER_TEMP/release.jks"
+ if [ -f keystore.properties ]; then
echo "[ci] keystore ready, signing as release"
+ ./gradlew :app:assembleRelease
else
echo "[ci] no keystore secret, building debug APK"
+ ./gradlew :app:assembleDebug
fi
- bash run_build.sh
-
- - name: Show APK info
- if: always()
- working-directory: android
- run: ls -la dist/ 2>/dev/null || echo "no dist/"
- name: Rename APK
run: |
- APK=$(ls android/dist/*.apk | head -1)
+ APK=$(find compose/app/build/outputs/apk -name '*.apk' | head -1)
DEST="Ghost-Downloader-v${{ needs.prepare.outputs.version }}-Android-arm64-v8a.apk"
mv "$APK" "$DEST"
echo "APK_FILE=$DEST" >> "$GITHUB_ENV"