SandHook.hooklib #1
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: SandHook.hooklib | |
| # 安卓依赖 com.swift.sandhook:hooklib:4.2.0 gradle仓库没了,手动构建aar | |
| # 基于此时的代码加以修补 https://github.com/asLody/SandHook/tree/16a59fa0eef011ca202814311b362a8a3bcda412 | |
| # 定义触发器: 在推送到主分支或创建任何 Tag 时触发 | |
| on: | |
| workflow_dispatch: # 允许手动触发 | |
| # 定义一系列工作 (Jobs) | |
| jobs: | |
| build: | |
| # 运行环境: 使用最新版本的 Ubuntu Linux | |
| runs-on: ubuntu-latest | |
| # 定义步骤 (Steps) | |
| steps: | |
| # --- 步骤 1: 下载目标仓库的特定提交代码 --- | |
| - name: 1. Checkout Target Repository at Specific Commit | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: asLody/SandHook | |
| ref: 16a59fa0eef011ca202814311b362a8a3bcda412 | |
| path: '' # 将代码下载到当前文件夹 | |
| # --- 步骤 2: 下载包含 .patch 文件的仓库 --- | |
| # 注意:我们使用另一个 checkout 步骤将补丁文件下载到不同的文件夹 | |
| - name: 2. Checkout Patch Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: patch-source-code # 将补丁仓库下载到 patch-source-code 文件夹 | |
| # --- 步骤 3: 应用补丁文件 --- | |
| - name: 3. Apply Patch to Target Code | |
| run: | | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git config user.name "github-actions[bot]" | |
| echo "准备应用补丁文件" | |
| # 使用 am 命令应用补丁 | |
| git am patch-source-code/SandHook/*.patch | |
| echo "补丁应用完成。" | |
| # 2. 设置 Java 环境 (Gradle 需要 Java) | |
| # 假设您的项目需要 Java 17 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| cache: 'gradle' # 缓存 Gradle 依赖,加快后续构建速度 | |
| # 3. 授予 Gradle 包装器执行权限 (Linux/macOS) | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| # 4. 执行 Gradle 的 assemble 命令 | |
| # 默认情况下,Gradle 库模块的 assemble 命令会生成 AAR 文件。 | |
| - name: Build with Gradle | |
| run: | | |
| ./gradlew :hooklib:assembleDebug | |
| # 5. 上传 AAR 文件作为构建产物 (Artifact) | |
| # AAR 文件通常位于 build/outputs/aar/ 目录下 | |
| - name: Upload AAR Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| # 您需要根据您的项目结构调整此路径 | |
| # 通常是 <module-name>/build/outputs/aar/<module-name>-debug.aar | |
| name: hooklib | |
| path: | | |
| hooklib/build/outputs/* |