README: 配置拆分后不可覆盖安装 xream 原版, 局域网配置改为 env 全大写变量, 删除目录结构章节 #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Sub-Store module | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| abi: | |
| description: '目标 ABI (all=全部 4 架构)' | |
| default: all | |
| type: choice | |
| options: [all, arm64-v8a, armeabi-v7a, x86_64, x86] | |
| version: | |
| description: 基础版本号 (留空则取 git tag, 如 v1.0.0) | |
| default: '' | |
| push: | |
| tags: ['v*'] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # 手动选择具体 ABI 时只构建该 ABI; 默认/tag 推送构建全部 4 架构 | |
| abi: ${{ (inputs.abi || 'all') == 'all' && fromJSON('["arm64-v8a","armeabi-v7a","x86_64","x86"]') || fromJSON(format('["{0}"]', inputs.abi || 'all')) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # 完整历史: versionCode 取 git 提交数 (ZygiskNext 风格) | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y zip unzip xz-utils | |
| - name: Build module | |
| env: | |
| TARGET_ABI: ${{ matrix.abi }} | |
| run: | | |
| VERSION="${{ inputs.version }}" | |
| [ -z "$VERSION" ] && VERSION="${GITHUB_REF_NAME:-}" | |
| ./build.sh "$VERSION" | |
| ls -lh build/*.zip | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sub-store-module-${{ matrix.abi }} | |
| path: build/*.zip | |
| if-no-files-found: error | |
| - name: Upload release (tag push) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: ncipollo/release-action@v1.14.0 | |
| with: | |
| tag: ${{ github.ref_name }} | |
| artifacts: build/*.zip | |
| allowUpdates: true | |
| replacesArtifacts: true | |
| omitBodyDuringUpdate: true | |
| body: | | |
| Sub-Store for Android 模块 | |
| 构建记录: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| # 发布 update JSON (各架构分开), 供管理器检测更新 | |
| # module.prop 的 updateJson 指向 gh-pages 分支上的 update-<abi>.json | |
| update-json: | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate update JSON (各架构分开) | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| VER="${TAG#v}" | |
| CODE=$(git rev-list HEAD --count) | |
| SHA=$(git rev-parse --short HEAD) | |
| for abi in arm64-v8a armeabi-v7a x86_64 x86; do | |
| SUFFIX="" | |
| [ "$abi" != "arm64-v8a" ] && SUFFIX="-${abi}" | |
| ZIP="sub-store-module-${VER}-${CODE}-${SHA}-release${SUFFIX}.zip" | |
| cat > "update-${abi}.json" <<JSON | |
| { | |
| "version": "$TAG", | |
| "versionCode": $CODE, | |
| "zipUrl": "https://github.com/Delusions6515/Sub-Store-Module/releases/download/$TAG/$ZIP", | |
| "changelog": "https://github.com/Delusions6515/Sub-Store-Module/releases/tag/$TAG" | |
| } | |
| JSON | |
| done | |
| ls -l update-*.json | |
| - name: Publish to gh-pages branch | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| git config user.name "Delusions6515" | |
| git config user.email "213381333+Delusions6515@users.noreply.github.com" | |
| if git fetch origin gh-pages:gh-pages 2>/dev/null; then | |
| git checkout gh-pages | |
| else | |
| # 首次: gh-pages 不存在, 用 orphan 分支创建 (清空索引只提交 JSON) | |
| git checkout --orphan gh-pages | |
| git rm -rf --cached . >/dev/null 2>&1 || git rm -rf . >/dev/null 2>&1 || true | |
| fi | |
| cp update-*.json . | |
| git add update-*.json | |
| if git commit -m "update json: $TAG"; then | |
| git push origin gh-pages | |
| else | |
| echo "update json 无变化, 跳过推送" | |
| fi |