feat(core): 重构 huya_platform #207
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-dev | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - 'dev' | |
| # If previous workflow is still running, we push again, we will cancel the previous workflow | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| # 打包 Android、iOS、Mac | |
| build-mac-ios-android: | |
| # https://github.com/actions/runner-images/issues/12541 | |
| runs-on: macos-15 | |
| permissions: | |
| contents: write | |
| steps: | |
| # 签出代码 | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: dev | |
| # APK 签名设置 | |
| - name: Download Android keystore | |
| id: android_keystore | |
| uses: timheuer/[email protected] | |
| with: | |
| fileName: keystore.jks | |
| encodedString: ${{ secrets.KEYSTORE_BASE64 }} | |
| - name: Create key.properties | |
| run: | | |
| echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > simple_live_app/android/key.properties | |
| echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> simple_live_app/android/key.properties | |
| echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> simple_live_app/android/key.properties | |
| echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> simple_live_app/android/key.properties | |
| # 设置 JAVA 环境 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: "21" | |
| cache: "gradle" | |
| # 设置 Flutter | |
| - name: Flutter action | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version-file: simple_live_app/pubspec.yaml | |
| cache: true | |
| # 打开 MAC Desktop 支持 | |
| - name: Enable Flutter Desktop | |
| run: flutter config --enable-macos-desktop | |
| # 更新 Flutter 的 packages | |
| - name: Restore packages | |
| run: | | |
| cd simple_live_app | |
| flutter pub get | |
| # 安装 appdmg npm install -g appdmg | |
| - name: Install appdmg | |
| run: npm install -g appdmg | |
| # 设置 Fastforge 环境 | |
| - name: Install fast-forge | |
| run: | | |
| git clone https://github.com/SlotSun/fastforge.git | |
| cd fastforge | |
| dart pub global activate melos | |
| melos run activate | |
| # 打包 APK | |
| - name: Build APK | |
| run: | | |
| cd simple_live_app | |
| flutter build apk --release --split-per-abi | |
| # 上传 Artifacts | |
| - name: Upload APK to Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android | |
| path: | | |
| simple_live_app/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
| simple_live_app/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
| simple_live_app/build/app/outputs/flutter-apk/app-x86_64-release.apk | |
| # 打包 iOS | |
| - name: Build IPA | |
| run: | | |
| cd simple_live_app | |
| flutter build ios --release --no-codesign | |
| # 创建未签名 ipa | |
| - name: Create IPA | |
| run: | | |
| cd simple_live_app | |
| mkdir build/ios/iphoneos/Payload | |
| cp -R build/ios/iphoneos/Runner.app build/ios/iphoneos/Payload/Runner.app | |
| cd build/ios/iphoneos/ | |
| zip -q -r ios_no_sign.ipa Payload | |
| cd ../../.. | |
| # 上传 IPA 至 Artifacts | |
| - name: Upload IPA to Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ios | |
| path: | | |
| simple_live_app/build/ios/iphoneos/ios_no_sign.ipa | |
| # 打包 MAC | |
| - name: Build MacOS | |
| run: | | |
| cd simple_live_app | |
| fastforge package --platform macos --targets dmg,zip --skip-clean | |
| # 上传 MAC 至 Artifacts | |
| - name: Upload MacOS to Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mac | |
| path: | | |
| simple_live_app/build/dist/*/*.dmg | |
| simple_live_app/build/dist/*/*.zip | |
| # 完成 | |
| - run: echo "🍏 This job's status is ${{ job.status }}." | |
| # 打包 Linux | |
| build-linux: | |
| strategy: | |
| matrix: | |
| include: | |
| - runner: ubuntu-24.04 | |
| arch: x86_64 | |
| - runner: ubuntu-24.04-arm | |
| arch: aarch64 | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: write | |
| steps: | |
| # 签出代码 | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: dev | |
| # 设置 Flutter 环境 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version-file: simple_live_app/pubspec.yaml | |
| channel: master | |
| # 安装依赖 | |
| - name: Update apt-get | |
| run: sudo apt-get update | |
| - name: Install Dependencies | |
| run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libmpv-dev mpv libasound2-dev | |
| # 打开 Linux Desktop 支持 | |
| - name: Enable Flutter Desktop | |
| run: flutter config --enable-linux-desktop | |
| # 更新 Flutter 的 packages | |
| - name: Restore Packages | |
| run: | | |
| cd simple_live_app | |
| flutter pub get | |
| # 设置 Fastforge 环境 | |
| - name: Install fast-forge | |
| run: | | |
| git clone https://github.com/SlotSun/fastforge.git | |
| cd fastforge | |
| dart pub global activate melos | |
| melos run activate | |
| # build Linux DEB \ ZIP | |
| - name: Build Linux | |
| run: | | |
| cd simple_live_app | |
| fastforge package --platform linux --targets deb,zip --skip-clean | |
| cd build/dist/* | |
| mv simple_live_app-*-linux.deb Slive-${{ matrix.arch }}-linux.deb | |
| mv simple_live_app-*-linux.zip Slive-${{ matrix.arch }}-linux.zip | |
| # 上传 Linux 包至 Artifacts | |
| - name: Upload Linux APP to Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-${{ matrix.arch }} | |
| path: | | |
| simple_live_app/build/dist/*/*.deb | |
| simple_live_app/build/dist/*/*.zip | |
| # 完成 | |
| - run: echo "🍏 Linux job's status is ${{ job.status }}." | |
| # 打包 Windows | |
| build-windows: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| # 签出代码 | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: dev | |
| # 设置 Flutter 环境 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version-file: simple_live_app/pubspec.yaml | |
| cache: true | |
| - name: Enable Flutter Desktop | |
| run: flutter config --enable-windows-desktop | |
| - name: Restore Packages | |
| run: | | |
| cd simple_live_app | |
| flutter clean | |
| flutter pub get | |
| # 设置 Fastforge 环境 和 Inno Setup | |
| - name: Install fast-forge and Inno Setup | |
| run: | | |
| git clone https://github.com/SlotSun/fastforge.git | |
| cd fastforge | |
| dart pub global activate melos | |
| melos run activate | |
| choco install innosetup | |
| # 添加中文安装引导 | |
| - name: Add Chinese language file for Inno Setup | |
| run: | | |
| cd simple_live_app | |
| Copy-Item "windows/packaging/exe/ChineseSimplified.isl" "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl" | |
| shell: powershell | |
| # build Windows ZIP\MSIX\EXE | |
| - name: Build Windows | |
| run: | | |
| cd simple_live_app | |
| fastforge package --platform windows --targets msix,zip,exe --skip-clean | |
| Get-ChildItem "simple_live_app-*" | ForEach-Object { | |
| $newName = $_.Name -replace '^simple_live_app', 'Slive' | |
| Rename-Item $_ -NewName $newName | |
| } | |
| shell: pwsh | |
| # 上传 Windows 至 Artifacts | |
| - name: Upload Windows APP to Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows | |
| path: | | |
| simple_live_app/build/dist/*/*.msix | |
| simple_live_app/build/dist/*/*.zip | |
| simple_live_app/build/dist/*/*.exe | |
| # 完成 | |
| - run: echo "🍏 Windows job's status is ${{ job.status }}." | |
| # 打包 Flatpak | |
| build-flatpak: | |
| strategy: | |
| matrix: | |
| include: | |
| - runner: ubuntu-24.04 | |
| arch: x86_64 | |
| - runner: ubuntu-24.04-arm | |
| arch: aarch64 | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: write | |
| steps: | |
| # 签出代码 | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: dev | |
| # 安装依赖 | |
| - name: Install dependencies | |
| run: | | |
| sudo add-apt-repository -y ppa:flatpak/stable | |
| sudo apt-get update -q | |
| sudo apt-get install -y flatpak flatpak-builder ca-certificates gnupg software-properties-common | |
| flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo | |
| git config --global protocol.file.allow always | |
| # 构建 Flatpak bundle | |
| - name: Build flatpak bundle | |
| run: | | |
| flatpak-builder build-dir flatpak/flatpak-manifest.yaml \ | |
| --arch=${{ matrix.arch }} \ | |
| --repo=${{ matrix.arch }} \ | |
| --force-clean \ | |
| --user \ | |
| --install-deps-from=flathub \ | |
| --ccache \ | |
| --disable-rofiles-fuse | |
| flatpak build-bundle ${{ matrix.arch }} Slive-${{ matrix.arch }}.flatpak io.github.SlotSun.dart_simple_live | |
| # 上传 Flatpak 包至 Artifacts | |
| - name: Upload linux flatpak to artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-flatpak-${{ matrix.arch }} | |
| path: Slive-*.flatpak | |
| # 完成 | |
| - run: echo "🍏 Flatpak job's status is ${{ job.status }}." |