From ec17e3f056f4cd5567b032a967edd63f8ab429f9 Mon Sep 17 00:00:00 2001 From: YuYu1015 Date: Fri, 31 Jul 2026 23:02:31 +0800 Subject: [PATCH 1/3] feat: ci/cd --- .github/workflows/android.yml | 112 ++++++++++++++++++++++++++++++++++ .github/workflows/ios.yml | 78 +++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 .github/workflows/android.yml create mode 100644 .github/workflows/ios.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 000000000..91111a127 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,112 @@ +name: Build Android + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + changes: + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + android: ${{ steps.filter.outputs.android }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + android: + - 'android/**' + - 'assets/**' + - 'lib/**' + - 'pubspec.yaml' + + Android: + needs: changes + if: ${{ needs.changes.outputs.android == 'true' }} + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: "25" + cache: "gradle" + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Cache Gradle + uses: actions/cache@v3 + env: + cache-name: cache-gradle + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/wrapper/gradle-wrapper.properties', '**/build.gradle') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + + - name: Cache Android NDK + uses: actions/cache@v4 + with: + path: | + /usr/local/lib/android/sdk/ndk/27.0.12077973 + /usr/local/lib/android/sdk/ndk/28.2.13676358 + key: ${{ runner.os }}-ndk-27-28 + + - name: Cache Android sdk + uses: actions/cache@v3 + env: + cache-name: cache-Android-sdk + with: + path: | + /usr/local/lib/android/sdk/platforms/android-31 + /usr/local/lib/android/sdk/platforms/android-33 + key: ${{ runner.os }}-android-platforms-${{ env.cache-name }}-${{ hashFiles('android/gradle.properties') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + + - name: Install dependencies and run build_runner + run: | + flutter pub get + dart run build_runner build --delete-conflicting-outputs + + - name: Decode keystore + run: | + echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/my-release-key.jks + + - name: Create key.properties + run: | + cat > android/key.properties << EOF + storePassword=${{ secrets.KEYSTORE_PASSWORD }} + keyPassword=${{ secrets.KEY_PASSWORD }} + keyAlias=${{ secrets.KEY_ALIAS }} + storeFile=my-release-key.jks + EOF + + - name: Build Release APK + run: flutter build apk --release --target-platform android-arm64,android-x64 + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: DPIP-Android-Release + path: build/app/outputs/flutter-apk/*.apk + retention-days: 7 + compression-level: 6 diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml new file mode 100644 index 000000000..a4b1a3c52 --- /dev/null +++ b/.github/workflows/ios.yml @@ -0,0 +1,78 @@ +name: Build iOS + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + changes: + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + ios: ${{ steps.filter.outputs.ios }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + ios: + - 'ios/**' + - 'assets/**' + - 'lib/**' + - 'pubspec.yaml' + + iOS: + needs: changes + if: ${{ needs.changes.outputs.ios == 'true' }} + runs-on: macos-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Cache CocoaPods + uses: actions/cache@v4 + with: + path: | + ios/Pods + ~/Library/Caches/CocoaPods + key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Install dependencies and run build_runner + run: | + flutter pub get + dart run build_runner build --delete-conflicting-outputs + + - name: Install iOS Pods + working-directory: ios + run: pod install --repo-update + + - name: Build iOS App and create IPA + run: | + flutter build ios --debug --no-codesign + mkdir -p Payload + cp -R build/ios/iphoneos/Runner.app Payload/Runner.app + zip -qr DPIP.ipa Payload + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: DPIP-iOS + path: | + build/ios/iphoneos/Runner.app + DPIP.ipa + retention-days: 7 + compression-level: 6 From 1e7276931bb1fde9d319e9cd203e3ba014b531fc Mon Sep 17 00:00:00 2001 From: YuYu1015 Date: Sat, 1 Aug 2026 13:59:21 +0800 Subject: [PATCH 2/3] fix: ci/cd --- .github/workflows/review.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 11a57a393..d18588d1f 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -117,6 +117,7 @@ jobs: llm_auth_token: ${{ secrets.OCR_LLM_AUTH_TOKEN }} llm_model: ${{ vars.OCR_LLM_MODEL }} llm_use_anthropic: ${{ vars.OCR_LLM_USE_ANTHROPIC }} + language: 中文 # For issue_comment triggers, pass the resolved refs; for # pull_request_target the action resolves them from the event. base_ref: ${{ steps.pr-context.outputs.base_ref }} From 7efad1a7757cbdacbca65d0cb27fda258f586709 Mon Sep 17 00:00:00 2001 From: YuYu1015 Date: Sat, 1 Aug 2026 14:01:41 +0800 Subject: [PATCH 3/3] fix: ci/cd --- .github/workflows/review.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index d18588d1f..b4403a57f 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -4,11 +4,11 @@ # (pull_request_target: opened/synchronize/reopened) and on-demand re-review # via comments starting with '/open-code-review' or '@open-code-review'. # -# Required secrets/vars (Settings -> Secrets and variables -> Actions): -# secret OCR_LLM_URL LLM API endpoint -# secret OCR_LLM_AUTH_TOKEN LLM auth token (mapped to OCR_LLM_TOKEN) -# variable OCR_LLM_MODEL model name -# variable OCR_LLM_USE_ANTHROPIC 'true' for Anthropic, 'false' for OpenAI-compatible +# Required org/repo secrets (Settings -> Secrets and variables -> Actions): +# OCR_LLM_URL LLM API endpoint +# OCR_LLM_AUTH_TOKEN LLM auth token (mapped to OCR_LLM_TOKEN) +# OCR_LLM_MODEL model name +# OCR_LLM_USE_ANTHROPIC 'true' for Anthropic, 'false' for OpenAI-compatible # # For the full list of action inputs/outputs and the four comment-posting modes # (sticky / incremental), see action.yml at the repo root. @@ -115,8 +115,7 @@ jobs: with: llm_url: ${{ secrets.OCR_LLM_URL }} llm_auth_token: ${{ secrets.OCR_LLM_AUTH_TOKEN }} - llm_model: ${{ vars.OCR_LLM_MODEL }} - llm_use_anthropic: ${{ vars.OCR_LLM_USE_ANTHROPIC }} + llm_model: ${{ secrets.OCR_LLM_MODEL }} language: 中文 # For issue_comment triggers, pass the resolved refs; for # pull_request_target the action resolves them from the event.