ClashRoot #59
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: ClashRoot | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 下载代码 | |
| uses: actions/checkout@v6 | |
| - name: 设置Flutter环境 | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.44.1' | |
| - name: 安装依赖 | |
| run: flutter pub get | |
| - name: Build APK (按 ABI 分割) | |
| run: flutter build apk --release --split-per-abi --no-tree-shake-icons | |
| - name: 上传 arm64-v8a APK | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
| archive: false | |
| - name: 下载 GeoIP 和 Geosite | |
| run: | | |
| mkdir -p ClashRoot | |
| curl -L -o ClashRoot/geoip.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat | |
| curl -L -o ClashRoot/geosite.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat | |
| # - name: 复制apk | |
| # run: | | |
| # mkdir -p ClashRoot/system/app/ClashRoot | |
| # cp build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ClashRoot/system/app/ClashRoot/ClashRoot.apk | |
| - name: 下载最新版本Clash | |
| run: | | |
| RELEASE_JSON=$(curl -s https://api.github.com/repos/MetaCubeX/mihomo/releases/latest) | |
| CLASH_URL=$(echo "$RELEASE_JSON" | grep -oP '"browser_download_url": "\K.*?mihomo-android-arm64-v8-v[0-9]+\.[0-9]+\.[0-9]+\.gz(?=")' | head -n 1) | |
| echo "Downloading Clash: $CLASH_URL" | |
| curl -L -o ClashRoot/clash.gz "$CLASH_URL" | |
| gunzip -f ClashRoot/clash.gz | |
| chmod +x ClashRoot/clash | |
| - name: 下载最新版本MetaCubeXD | |
| run: | | |
| RELEASE_JSON=$(curl -s https://api.github.com/repos/MetaCubeX/metacubexd/releases/latest) | |
| METACUBEXD_URL=$(echo "$RELEASE_JSON" | grep -oP '"browser_download_url": "\K.*?compressed-dist.tgz(?=")' | head -n 1) | |
| echo "Downloading MetaCubeXD: $METACUBEXD_URL" | |
| mkdir -p ClashRoot/metacubexd | |
| curl -L -o metacubexd.tgz "$METACUBEXD_URL" | |
| tar -xzf metacubexd.tgz -C ClashRoot/metacubexd | |
| rm metacubexd.tgz | |
| - name: 打包 ClashRoot.zip | |
| run: | | |
| (cd ClashRoot && zip -r ../ClashRoot.zip .) | |
| - name: 上传产物 | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: ClashRoot.zip | |
| archive: false |