Skip to content

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

ci(android): GitHub Actions 自动打包

XiaoYouChR4fb80ffc498e
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
new file mode 100644
index 00000000..7265a868
--- /dev/null
+++ b/.github/workflows/android.yml
@@ -0,0 +1,62 @@
+name: Build Android APK
+
+# 仅人工触发。本地与 CI 跑同一个 android/Dockerfile + run_build.sh:默认官方源(GH runner 海外直连最快),
+# 勾选 use_cn_mirror 才传 GD3_CN_MIRROR=1 用国内镜像(自托管/CN runner 才划算)。
+# 配齐 keystore secret 则出签名 release APK,否则回退 debug。产物传 workflow artifact。
+
+on:
+ workflow_dispatch:
+ inputs:
+ use_cn_mirror:
+ description: '用国内镜像源构建(自托管/CN runner 才需要;GH 海外 runner 留空更快)'
+ type: boolean
+ default: false
+
+permissions:
+ contents: read
+
+jobs:
+ build-android:
+ runs-on: ubuntu-latest
+ timeout-minutes: 90
+ 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:
+ - uses: actions/checkout@v4
+
+ # 构建需 ~12-15GB(镜像 5GB + NDK + .buildozer + gradle),清掉预装 SDK 腾出 ~20GB。
+ - name: Free disk space
+ run: |
+ sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android \
+ /usr/local/share/boost /usr/local/share/powershell /opt/hostedtoolcache/CodeQL \
+ "${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}" || true
+ sudo docker image prune -af || true
+ df -h /
+
+ - name: Build APK (image + container)
+ working-directory: android
+ run: |
+ if [ -n "$ANDROID_KEYSTORE_BASE64" ]; then
+ echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"
+ export GD3_KEYSTORE="$RUNNER_TEMP/release.jks"
+ echo "[ci] keystore 就绪,签名为 release"
+ else
+ echo "[ci] 无 keystore secret,出 debug APK"
+ 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: Upload APK
+ uses: actions/upload-artifact@v4
+ with:
+ name: ghost-downloader-android
+ path: android/dist/*.apk
+ if-no-files-found: error
+ retention-days: 14
diff --git a/.gitignore b/.gitignore
index e7f5f229..5b0a0ffc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,4 +36,8 @@ browser_extension/firefox/
# 忽略 uv 锁文件
uv.lock
-.playwright-mcp
\ No newline at end of file
+.playwright-mcp
+# Android release 签名密钥库(绝不入库) + 桌面跑测时写出的运行时配置
+*.jks
+*.keystore
+/config/