fix(*) #139
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: app-build-action | |
| # 推送Tag时触发 或者 手动触发 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Tag name for the release' | |
| required: true | |
| default: 'v1.0.0' | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| build-android: | |
| runs-on: macos-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| # 签出代码 | |
| - name: 签出代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag_name }} | |
| # 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 | |
| # 设置JAVA环境 | |
| - name: 设置JAVA环境 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: "17" | |
| cache: 'gradle' | |
| # 设置Flutter | |
| - name: 设置Flutter环境 | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.32.7' | |
| cache: true | |
| # 更新Flutter的packages | |
| - name: 更新Flutter的packages | |
| run: flutter pub get | |
| # 打包APK | |
| - name: 打包APK | |
| run: flutter build apk --release --split-per-abi | |
| # 上传APK至Artifacts | |
| - name: 上传APK至Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android | |
| path: | | |
| build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
| build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
| build/app/outputs/flutter-apk/app-x86_64-release.apk | |
| # 读取版本信息 | |
| - name: 读取版本信息 | |
| id: version | |
| uses: juliangruber/read-file-action@v1 | |
| with: | |
| path: assets/version.json | |
| # 上传至Release | |
| - name: 上传至Release | |
| uses: softprops/action-gh-release@v2.2.1 | |
| with: | |
| name: "${{ github.event.inputs.tag_name }}" | |
| body: "${{ fromJson(steps.version.outputs.content).version_desc }}" | |
| prerelease: false | |
| token: ${{ secrets.TOKEN }} | |
| files: | | |
| build/app/outputs/flutter-apk/app-x86_64-release.apk | |
| build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
| build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
| # 完成 | |
| - name: 输出任务状态 | |
| if: always() | |
| run: echo "🍏 Android job's status is ${{ job.status }}." | |
| build-windows: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| # 签出代码 | |
| - name: 签出代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag_name }} | |
| # 设置Flutter环境 | |
| - name: 设置Flutter环境 | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.32.7" | |
| cache: true | |
| - name: 启用Flutter桌面支持 | |
| run: flutter config --enable-windows-desktop | |
| - name: 更新Flutter的packages | |
| run: flutter pub get | |
| # 安装flutter_distributor | |
| - name: 安装flutter_distributor | |
| run: dart pub global activate flutter_distributor | |
| # 构建Windows ZIP\MSIX | |
| - name: 构建Windows应用 | |
| run: flutter_distributor package --platform windows --targets msix,zip,exe --skip-clean | |
| # 上传Windows应用至Artifacts | |
| - name: 上传Windows应用至Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows | |
| path: | | |
| build/dist/*/*.msix | |
| build/dist/*/*.zip | |
| build/dist/*/*.exe | |
| # 读取版本信息 | |
| - name: 读取版本信息 | |
| id: version | |
| uses: juliangruber/read-file-action@v1 | |
| with: | |
| path: assets/version.json | |
| # 上传至Release | |
| - name: 上传至Release | |
| uses: softprops/action-gh-release@v2.2.1 | |
| with: | |
| name: "${{ github.event.inputs.tag_name }}" | |
| body: "${{ fromJson(steps.version.outputs.content).version_desc }}" | |
| prerelease: false | |
| token: ${{ secrets.TOKEN }} | |
| files: | | |
| build/dist/*/*.msix | |
| build/dist/*/*.zip | |
| build/dist/*/*.exe | |
| # 完成 | |
| - name: 输出任务状态 | |
| if: always() | |
| run: echo "🍏 Windows job's status is ${{ job.status }}." |