From f5bfc60f466c35b6207ac2fbb605a7576b97ea5d Mon Sep 17 00:00:00 2001 From: jiqiu2021 Date: Wed, 25 Jun 2025 23:06:03 +0800 Subject: [PATCH] fix: merge ci --- .github/workflows/build-release.yml | 153 ---------------------------- .github/workflows/build.yml | 27 ----- .github/workflows/ci.yml | 63 +++++++++++- 3 files changed, 62 insertions(+), 181 deletions(-) delete mode 100644 .github/workflows/build-release.yml delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml deleted file mode 100644 index 4a8df81..0000000 --- a/.github/workflows/build-release.yml +++ /dev/null @@ -1,153 +0,0 @@ -name: Build and Release - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - version: - description: 'Version tag (e.g., v1.0.0)' - required: true - default: 'v1.0.0' - branch: - description: 'Branch to build from' - required: false - default: 'main' - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - - name: Cache Gradle dependencies - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Setup Android SDK - uses: android-actions/setup-android@v3 - - - name: Install NDK and CMake - run: | - echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "ndk;25.2.9519653" - echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "cmake;3.22.1" - - - name: Build ConfigApp - run: | - cd configapp - ../gradlew assembleDebug - cd .. - - - name: Build Module - run: | - cd module - ../gradlew assembleRelease - cd .. - - - name: Package Module - run: | - # 获取版本信息 - if [ "${{ github.event_name }}" == "push" ]; then - VERSION="${GITHUB_REF#refs/tags/}" - else - VERSION="${{ github.event.inputs.version }}" - fi - VERSION_CODE=$(echo $VERSION | sed 's/[^0-9]//g') - - # 创建临时目录 - TEMP_DIR="build/magisk_module" - rm -rf $TEMP_DIR - mkdir -p $TEMP_DIR - - # 创建 module.prop - cat > $TEMP_DIR/module.prop << EOF - id=zygisk-myinjector - name=Zygisk MyInjector - version=$VERSION - versionCode=$VERSION_CODE - author=jiqiu2022 - description=A Zygisk module for dynamic library injection with ConfigApp - EOF - - # 复制文件 - cp module/service.sh $TEMP_DIR/ - chmod 755 $TEMP_DIR/service.sh - - # 创建 zygisk 目录并复制 so 文件 - mkdir -p $TEMP_DIR/zygisk - for arch in armeabi-v7a arm64-v8a x86 x86_64; do - SO_PATH="module/build/intermediates/stripped_native_libs/release/out/lib/$arch/libmyinjector.so" - if [ -f "$SO_PATH" ]; then - cp "$SO_PATH" "$TEMP_DIR/zygisk/$arch.so" - fi - done - - # 复制 ConfigApp APK - cp configapp/build/outputs/apk/debug/configapp-debug.apk $TEMP_DIR/configapp.apk - - # 创建 META-INF 目录 - mkdir -p $TEMP_DIR/META-INF/com/google/android - touch $TEMP_DIR/META-INF/com/google/android/update-binary - touch $TEMP_DIR/META-INF/com/google/android/updater-script - - # 打包 - cd $TEMP_DIR - zip -r ../../zygisk-myinjector-$VERSION.zip * - cd ../.. - - # 列出文件内容 - echo "Module contents:" - unzip -l zygisk-myinjector-$VERSION.zip - - # 重命名 APK 以包含版本号 - cp configapp/build/outputs/apk/debug/configapp-debug.apk ./ConfigApp-$VERSION.apk - - - name: Create Release - id: create_release - uses: softprops/action-gh-release@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - tag_name: ${{ github.event_name == 'push' && github.ref || github.event.inputs.version }} - name: Release ${{ github.event_name == 'push' && github.ref || github.event.inputs.version }} - body: | - ## Zygisk MyInjector Release - - ### 功能特性 - - 动态 SO 注入 - - 图形化配置界面 - - 支持 Riru Hide - - 自动安装配置应用 - - ### 安装说明 - 1. 下载 `zygisk-myinjector-*.zip` - 2. 在 Magisk Manager 中安装模块 - 3. 重启设备 - 4. ConfigApp 会自动安装 - - ### 更新日志 - 请查看 [commits](https://github.com/${{ github.repository }}/commits/${{ github.sha }}) - draft: false - prerelease: false - files: | - ./zygisk-myinjector-*.zip - ./ConfigApp-*.apk \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index ec41728..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build -on: - workflow_dispatch: - inputs: - package_name: - description: "Package name of the game:" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 11 - cache: gradle - - run: | - chmod +x ./gradlew - sed -i 's/moduleDescription = "/moduleDescription = "(${{ github.event.inputs.package_name }}) /g' module.gradle - sed -i "s/com.game.packagename/${{ github.event.inputs.package_name }}/g" module/src/main/cpp/game.h - ./gradlew :module:assembleRelease - - uses: actions/upload-artifact@v3 - with: - name: zygisk-il2cppdumper - path: out/magisk_module_release/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13608e5..5ebeefd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,24 @@ on: pull_request: branches: [ main, develop, master ] workflow_dispatch: # 允许手动触发 + inputs: + create_release: + description: 'Create a release after build' + required: false + default: 'false' + type: choice + options: + - 'true' + - 'false' + release_tag: + description: 'Release tag (only if creating release)' + required: false + default: 'ci-latest' + +permissions: + contents: write # 允许创建 release + packages: write # 允许上传包 + actions: read # 允许读取 actions jobs: build: @@ -115,4 +133,47 @@ jobs: with: name: configapp-ci-${{ github.sha }} path: configapp/build/outputs/apk/debug/configapp-debug.apk - retention-days: 7 \ No newline at end of file + retention-days: 7 + + - name: Prepare Release Files + if: github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true' + run: | + # 准备发布文件 + mkdir -p release-files + cp zygisk-myinjector-ci.zip release-files/zygisk-myinjector-${{ github.event.inputs.release_tag }}.zip + cp configapp/build/outputs/apk/debug/configapp-debug.apk release-files/ConfigApp-${{ github.event.inputs.release_tag }}.apk + + echo "Release files:" + ls -la release-files/ + + - name: Create Release + if: github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true' + uses: softprops/action-gh-release@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag_name: ${{ github.event.inputs.release_tag }} + name: CI Release ${{ github.event.inputs.release_tag }} + body: | + ## CI Build Release + + - **Build Type**: Manual CI Release + - **Commit**: ${{ github.sha }} + - **Branch**: ${{ github.ref_name }} + - **Run ID**: ${{ github.run_id }} + + ### 下载 + - 模块文件: `zygisk-myinjector-${{ github.event.inputs.release_tag }}.zip` + - 配置应用: `ConfigApp-${{ github.event.inputs.release_tag }}.apk` + + ### 安装说明 + 1. 在 Magisk Manager 中安装模块 ZIP + 2. 重启设备 + 3. ConfigApp 会自动安装 + + --- + *这是一个 CI 构建版本,可能不稳定* + draft: false + prerelease: true + files: | + release-files/zygisk-myinjector-*.zip + release-files/ConfigApp-*.apk \ No newline at end of file