From 51180c01507eefee2e9d5cf4a42d778c4263e97f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Nov 2025 02:02:11 +0000 Subject: [PATCH 1/2] Initial plan From 7c36b19e0a5d3cb2d934228aca65fca618cd310f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Nov 2025 02:06:36 +0000 Subject: [PATCH 2/2] Remove artifact upload on every commit, only create APK on releases Co-authored-by: Cross2pro <30151531+Cross2pro@users.noreply.github.com> --- .github/workflows/README.md | 62 +++++++++++++++-------------- .github/workflows/android-build.yml | 10 +---- WORKFLOW_CHANGES.md | 60 +++++++++++++++++----------- 3 files changed, 70 insertions(+), 62 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 4ce8f90..29b28d9 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -45,28 +45,28 @@ The workflow requires the following GitHub Secrets to sign the APK: ./gradlew clean assembleRelease ``` 6. **验证 APK** / Verify APK was built -7. **提取版本信息** / Extract version information -8. **上传 Artifact** / Upload artifact - - 名称格式 / Name format: `android-virtual-cam-v{version}-signed` - - 在每次成功构建后都会上传 / Uploaded after every successful build -9. **创建 GitHub Release** / Create GitHub Release (only on tag push) +7. **提取版本信息并创建 Release** / Extract version info and create Release (only on tag push) - 仅在推送标签时触发 / Only triggered when pushing tags + - 自动提取版本信息 / Automatically extracts version information + - 创建 GitHub Release 并上传 APK / Creates GitHub Release and uploads APK - 包含详细的发布说明 / Contains detailed release notes -### Artifacts +### 获取 APK / Getting the APK -每次成功构建后,签名的 APK 会作为 Artifact 上传: +APK 文件仅在创建 Release 时生成和发布: -After every successful build, the signed APK is uploaded as an Artifact: +The APK file is only generated and published when creating a Release: -- **名称** / Name: `android-virtual-cam-v{version}-signed` -- **文件** / File: `app-release.apk` -- **保留时间** / Retention: 90 天(GitHub 默认)/ 90 days (GitHub default) +**方式 / Method**: 从 GitHub Releases 下载 / Download from GitHub Releases -要下载 Artifact: -1. 进入 Actions 标签页 / Go to Actions tab -2. 选择工作流运行 / Select a workflow run -3. 在 "Artifacts" 部分下载 / Download from "Artifacts" section +1. 进入仓库的 Releases 页面 / Go to the repository's Releases page +2. 选择想要的版本 / Select the desired version +3. 直接下载 APK 文件 / Download the APK file directly + +**注意** / Note: +- Artifacts 不再在每次提交时生成 / Artifacts are no longer generated on every commit +- APK 仅在推送标签创建 Release 时可用 / APK is only available when creating a Release by pushing a tag +- 从 Release 下载的 APK 文件可直接安装,无需解压 / APK files downloaded from Releases can be installed directly without unzipping ### Releases @@ -88,18 +88,18 @@ To create a GitHub Release: ### 故障排除 / Troubleshooting -#### 未生成 Artifacts / No Artifacts Generated +#### 未生成 APK / No APK Generated -**问题** / Problem: 工作流运行成功但没有 Artifacts +**问题** / Problem: 工作流运行成功但没有 APK 可下载 **原因** / Cause: -- 签名密钥未配置 / Signing secrets not configured -- APK 构建失败 / APK build failed +- APK 仅在创建 Release 时生成 / APK is only generated when creating a Release +- 普通的推送不会生成可下载的 APK / Regular pushes do not generate downloadable APK **解决方案** / Solution: -1. 检查工作流日志中的 "Validate signing secrets" 步骤 -2. 确保所有 4 个密钥都已配置 / Ensure all 4 secrets are configured -3. 检查构建日志是否有错误 / Check build logs for errors +1. 创建并推送标签以触发 Release / Create and push a tag to trigger a Release +2. 检查工作流日志中的 "Validate signing secrets" 步骤 +3. 确保所有 4 个签名密钥都已配置 / Ensure all 4 signing secrets are configured #### 未创建 Release / No Release Created @@ -140,16 +140,18 @@ versionName "4.4" ### 手动运行 / Manual Trigger -目前工作流不支持手动触发。如需手动触发,可以在工作流文件中添加: +工作流支持手动触发: -Currently, manual triggering is not supported. To enable it, add to the workflow file: +The workflow supports manual triggering: -```yaml -on: - push: - pull_request: - workflow_dispatch: # 添加此行 / Add this line -``` +1. 进入 Actions 标签页 / Go to Actions tab +2. 选择 "Android Build" 工作流 / Select "Android Build" workflow +3. 点击 "Run workflow" / Click "Run workflow" +4. 选择分支并运行 / Select branch and run + +**注意** / Note: 手动运行只会构建和验证 APK,不会创建 Release。要创建 Release,必须推送标签。 + +Manual runs will only build and verify the APK, but will not create a Release. To create a Release, you must push a tag. ## 相关链接 / Related Links diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 6976374..623f68a 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -83,7 +83,7 @@ jobs: ls -lh app/build/outputs/apk/release/ - name: Get version info - if: steps.signing.outputs.signing_ready == 'true' + if: steps.signing.outputs.signing_ready == 'true' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') id: version run: | VERSION_NAME=$(grep "versionName" app/build.gradle | awk '{print $2}' | tr -d '"') @@ -92,14 +92,6 @@ jobs: echo "version_code=${VERSION_CODE}" >> "$GITHUB_OUTPUT" echo "Version: ${VERSION_NAME} (${VERSION_CODE})" - - name: Upload signed APK artifact - if: steps.signing.outputs.signing_ready == 'true' - uses: actions/upload-artifact@v4 - with: - name: android-virtual-cam-v${{ steps.version.outputs.version_name }}-signed - path: app/build/outputs/apk/release/app-release.apk - if-no-files-found: error - - name: Publish signed APK to GitHub Release if: steps.signing.outputs.signing_ready == 'true' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 diff --git a/WORKFLOW_CHANGES.md b/WORKFLOW_CHANGES.md index e6bf677..5082885 100644 --- a/WORKFLOW_CHANGES.md +++ b/WORKFLOW_CHANGES.md @@ -67,30 +67,27 @@ Created `.github/workflows/README.md` containing workflow overview, secret setup 1. ✅ 验证签名密钥配置 / Validate signing secrets 2. ✅ 如果配置完整,构建签名 APK / Build signed APK if configured 3. ✅ 验证 APK 已生成 / Verify APK was generated -4. ✅ 提取版本信息 / Extract version information -5. ✅ **上传 Artifact** / **Upload Artifact** - - 命名: `android-virtual-cam-v{version}-signed` - - 包含签名的 APK 文件 +4. ℹ️ **不上传 Artifact** / **No Artifact Upload** + - 节省存储空间和构建时间 / Saves storage space and build time + - 仅用于 CI/CD 验证 / Only for CI/CD validation ### 推送标签时 / On Tag Push -1. ✅ 执行所有上述步骤 / Execute all above steps -2. ✅ **创建 GitHub Release** / **Create GitHub Release** +1. ✅ 执行所有构建步骤 / Execute all build steps +2. ✅ 提取版本信息 / Extract version information +3. ✅ **创建 GitHub Release** / **Create GitHub Release** - Release 名称: `Android Virtual Cam v{version}` - 附带详细的双语说明 - - 包含签名的 APK 下载 + - **直接附加 APK 文件供下载** / **APK file directly attached for download** + - APK 可以直接安装,无需解压 / APK can be installed directly without unzipping ## 使用方法 / Usage -### 获取 Artifacts / Get Artifacts -```bash -# 推送代码 -git push origin main +### 获取 APK / Get APK -# 然后访问: -# GitHub → Actions → 选择运行 → Artifacts 部分下载 -``` +APK 仅在创建 Release 时可用: + +APK is only available when creating a Release: -### 创建 Release / Create Release ```bash # 1. 更新版本号(app/build.gradle) versionCode 29 @@ -102,7 +99,22 @@ git commit -m "Bump version to 4.5" git tag v4.5 git push origin main v4.5 -# 3. 自动创建 Release,包含签名 APK +# 3. 自动创建 Release,包含可直接下载安装的签名 APK +# APK file will be directly attached to the Release for easy download +``` + +### 开发和测试 / Development and Testing + +普通的推送和 PR 会触发构建验证,但不会生成可下载的 APK: + +Regular pushes and PRs trigger build validation but do not generate downloadable APK: + +```bash +# 推送代码(仅验证构建) +git push origin main + +# 构建会运行,但不会上传 Artifact +# Build will run but no artifacts will be uploaded ``` ### 手动运行 / Manual Run @@ -162,10 +174,12 @@ Ensure all required secrets are configured in GitHub repository settings, test w ## 结论 / Conclusion 工作流现在能够: -✅ 在每次成功构建后上传签名 APK 作为 Artifact -✅ 在推送标签时自动创建包含签名 APK 的 Release -✅ 提供清晰的版本信息和双语说明 -✅ 支持手动触发以便测试 -✅ 包含完整的文档和故障排除指南 - -Workflow now successfully uploads signed APK as Artifact after every build, automatically creates Releases with signed APK on tag push, provides clear version info and bilingual notes, supports manual triggers, and includes complete documentation. +✅ 在每次推送时验证构建(不生成 Artifact)/ Validate builds on every push (without generating Artifacts) +✅ 在推送标签时自动创建包含签名 APK 的 Release / Automatically create Releases with signed APK on tag push +✅ 提供清晰的版本信息和双语说明 / Provide clear version info and bilingual notes +✅ 支持手动触发以便测试 / Support manual triggers for testing +✅ 包含完整的文档和故障排除指南 / Include complete documentation and troubleshooting guide +✅ APK 文件直接附加到 Release,无需解压即可下载安装 / APK files directly attached to Releases, downloadable and installable without unzipping +✅ 节省存储空间,避免不必要的 Artifact 生成 / Save storage space by avoiding unnecessary Artifact generation + +Workflow now validates builds on every push without generating Artifacts, automatically creates Releases with signed APK on tag push, provides clear version info and bilingual notes, supports manual triggers, includes complete documentation, attaches APK files directly to Releases for easy download and installation, and saves storage space by avoiding unnecessary Artifact generation.