Merge branch 'main' of https://github.com/youyidexiaochuan/edit #7
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: Android Release (No ICU) | ||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| build-and-release: | ||
| name: Build ${{ matrix.name }} | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - target: aarch64-linux-android | ||
| name: arm64 | ||
| - target: armv7-linux-androideabi | ||
| name: armv7 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Install Rust Nightly | ||
| uses: dtolnay/rust-toolchain@nightly | ||
| with: | ||
| targets: ${{ matrix.target }} | ||
| - name: Install Cross | ||
| run: cargo install cross --git https://github.com/cross-rs/cross | ||
| # 自动修复 32 位源码报错 (依然保留,以防万一) | ||
| - name: Patch Source Code | ||
| run: | | ||
| if [ -f crates/edit/src/sys/unix.rs ]; then | ||
| sed -i 's/st_dev: stat.st_dev/st_dev: stat.st_dev as _/g' crates/edit/src/sys/unix.rs | ||
| sed -i 's/st_ino: stat.st_ino/st_ino: stat.st_ino as _/g' crates/edit/src/sys/unix.rs | ||
| echo "Patch applied." | ||
| fi | ||
| # 【关键修改】加入 --no-default-features 参数 | ||
| # 这会关闭 ICU 依赖,生成纯静态、无依赖的可执行文件 | ||
| # 同时加入 strip=true 和 lto=true 以大幅减小体积 | ||
| - name: Build Binary (Lightweight) | ||
| run: | | ||
| cross build --target ${{ matrix.target }} --config .cargo/release-nightly.toml --release --no-default-features --config profile.release.strip=true --config profile.release.lto=true | ||
| - name: Prepare Files | ||
| run: | | ||
| SRC="target/${{ matrix.target }}/release" | ||
| # 重命名文件 | ||
| if [ -f "$SRC/edit" ]; then | ||
| mv "$SRC/edit" "edit-${{ github.ref_name }}-${{ matrix.name }}" | ||
| elif [ -f "$SRC/msedit" ]; then | ||
| mv "$SRC/msedit" "msedit-${{ github.ref_name }}-${{ matrix.name }}" | ||
| fi | ||
| - name: Release to GitHub | ||
| uses: softprops/action-gh-release@v1 | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| with: | ||
| files: | | ||
| edit-${{ github.ref_name }}-${{ matrix.name }} | ||
| msedit-${{ github.ref_name }}-${{ matrix.name }} | ||