fix(*) #57
Workflow file for this run
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: build-android-Tv | |
| # 推送Tag时触发 或者 手动触发 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Tag name for the release' | |
| required: false | |
| default: 'v1.0.0' | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| build-android: | |
| runs-on: macos-latest | |
| permissions: | |
| contents: write | |
| strategy: | |
| matrix: | |
| # 定义分支矩阵:分别从 main 和 without-exo 分支拉取代码打包 | |
| branch: [main, without-exo] | |
| steps: | |
| # 1. 签出代码:根据矩阵变量动态切换分支 | |
| - name: 签出代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| # 2. APK签名设置 | |
| - name: 下载Android keystore | |
| id: android_keystore | |
| uses: timheuer/base64-to-file@v1.2 | |
| with: | |
| fileName: key.jks | |
| encodedString: ${{ secrets.KEYSTORE_BASE64 }} | |
| - name: 创建key.properties | |
| run: | | |
| echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/key.properties | |
| echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties | |
| echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties | |
| echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties | |
| # 3. 设置环境 | |
| - name: 设置JAVA环境 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: "17" | |
| cache: 'gradle' | |
| - name: 设置Flutter环境 | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: 更新Flutter的packages | |
| run: flutter pub get | |
| # 4. 打包 APK | |
| - name: 打包APK | |
| run: flutter build apk --release --split-per-abi --android-skip-build-dependency-validation | |
| # 5. 重命名文件 (关键):区分不同分支的产物 | |
| - name: 重命名 APK 文件 | |
| run: | | |
| cd build/app/outputs/flutter-apk/ | |
| if [ "${{ matrix.branch }}" = "without-exo" ]; then | |
| for f in app-*-release.apk; do | |
| mv "$f" "${f%-release.apk}-without-exo.apk" | |
| done | |
| fi | |
| # 6. 读取版本信息 (确保两个分支的 assets 目录下都有此文件) | |
| - name: 读取版本信息 | |
| id: version | |
| uses: juliangruber/read-file-action@v1 | |
| with: | |
| path: assets/version.json | |
| # 7. 上传至 Release | |
| - name: 上传至Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.tag_name || github.ref_name }} | |
| name: ${{ github.event.inputs.tag_name || github.ref_name }} | |
| body: | | |
| 📦 纯粹直播 ${{ github.ref_name }} | |
| 本次更新内容: | |
| ${{ fromJson(steps.version.outputs.content).version_desc }} | |
| 📺 版本说明: | |
| • 标准版:包含完整播放器内核 (来自 main 分支) | |
| • 精简版:不含 Exo 内核,文件名带 -without-exo (来自 without-exo 分支) | |
| 本软件为开源项目,无广告,无病毒,若安装时出现病毒误报,可自行斟酌。 | |
| prerelease: false | |
| # 使用通配符匹配当前任务产出的所有 APK | |
| files: build/app/outputs/flutter-apk/app-*.apk | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # 完成 | |
| - name: 输出任务状态 | |
| if: always() | |
| run: echo "🍏 Branch ${{ matrix.branch }} build status is ${{ job.status }}." |