From 72e873eb1b77e5c7dc61efd07986938c7196815c Mon Sep 17 00:00:00 2001 From: qinshah Date: Mon, 20 Jul 2026 18:50:17 +0000 Subject: [PATCH] ci: consolidate workflows to release and pr_check Optimize GitHub Actions to only two workflows: - release.yml: build & release ohos hap. Uses dart .vscode/build_env.dart to generate .vscode/env.json only (drops pili_release.json and ps1 scripts). All other actions deleted. - pr_check.yml: runs `dart analyze --no-fatal-warnings` on PRs so the check fails only on actual errors, not on info/warning lints in vendored Flutter widgets under lib/common/widgets/flutter/. Removed: .github/workflows/{build,ios,linux_x64,mac,test,win_x64}.yml .github/workflows/release.yaml lib/scripts/{build,patch}.ps1 Verification: both workflows have been manually triggered and passed on the feat/ci branch. Run history available at: https://github.com/qinshah/PiliPlus/actions - release: https://github.com/qinshah/PiliPlus/actions/runs/29766727213 - pr_check: https://github.com/qinshah/PiliPlus/actions/runs/29768632667 --- .github/workflows/build.yml | 166 ----------- .github/workflows/ios.yml | 60 ---- .github/workflows/linux_x64.yml | 269 ------------------ .github/workflows/mac.yml | 64 ----- .github/workflows/pr_check.yml | 38 +++ .../workflows/{release.yaml => release.yml} | 47 +-- .github/workflows/test.yml | 97 ------- .github/workflows/win_x64.yml | 87 ------ lib/scripts/build.ps1 | 57 ---- lib/scripts/patch.ps1 | 75 ----- 10 files changed, 64 insertions(+), 896 deletions(-) delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/ios.yml delete mode 100644 .github/workflows/linux_x64.yml delete mode 100644 .github/workflows/mac.yml create mode 100644 .github/workflows/pr_check.yml rename .github/workflows/{release.yaml => release.yml} (77%) delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/win_x64.yml delete mode 100644 lib/scripts/build.ps1 delete mode 100644 lib/scripts/patch.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 6e76e1fc5a..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,166 +0,0 @@ -name: Build - -on: - workflow_dispatch: - inputs: - build_android: - description: "Build Android" - required: false - default: true - type: boolean - - build_ios: - description: "Build iOS" - required: false - default: true - type: boolean - - build_mac: - description: "Build Mac" - required: false - default: true - type: boolean - - build_win_x64: - description: "Build Win-x64" - required: false - default: true - type: boolean - - build_linux_x64: - description: "Build Linux-x64" - required: false - default: true - type: boolean - - tag: - description: "tag" - required: false - default: "" - type: string - -jobs: - android: - if: ${{ (github.event_name == 'pull_request' && github.repository == 'bggRGjQaUbCoE/PiliPlus') || github.event.inputs.build_android == 'true' }} - name: Release Android - runs-on: ubuntu-latest - permissions: write-all - - steps: - - name: 代码迁出 - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: 构建Java环境 - uses: actions/setup-java@v5 - with: - distribution: "zulu" - java-version: "17" - cache: "gradle" - cache-dependency-path: | - android/*.gradle* - android/**/gradle-wrapper.properties - - - name: 安装Flutter - uses: subosito/flutter-action@v2 - id: flutter-action - with: - channel: stable - flutter-version-file: pubspec.yaml - cache: true - - - name: Apply Patch - shell: pwsh - run: lib/scripts/patch.ps1 android - continue-on-error: true - - - name: Write key - if: github.event_name == 'workflow_dispatch' - run: | - if [ ! -z "${{ secrets.SIGN_KEYSTORE_BASE64 }}" ]; then - echo "${{ secrets.SIGN_KEYSTORE_BASE64 }}" | base64 --decode > android/app/key.jks - echo storeFile='key.jks' >> android/key.properties - echo storePassword='${{ secrets.KEYSTORE_PASSWORD }}' >> android/key.properties - echo keyAlias='${{ secrets.KEY_ALIAS }}' >> android/key.properties - echo keyPassword='${{ secrets.KEY_PASSWORD }}' >> android/key.properties - fi - - - name: Set and Extract version - if: ${{ github.event_name == 'workflow_dispatch' }} - shell: pwsh - run: lib/scripts/build.ps1 android - - - name: Flutter Build Release Apk - if: ${{ github.event_name == 'workflow_dispatch' }} - run: flutter build apk --release --split-per-abi --dart-define-from-file=pili_release.json --pub - - - name: Flutter Build Dev Apk - if: ${{ github.event_name == 'pull_request' }} - run: | - flutter build apk --release --split-per-abi --android-project-arg dev=1 --pub - - - name: Rename - run: | - for file in build/app/outputs/flutter-apk/app-*-release.apk; do - abi=$(echo "$file" | sed -E 's|.*app-(.*)-release\.apk|\1|') - mv "$file" "PiliPlus_android_${{ env.version }}_${abi}.apk" - done - shell: bash - - - name: Release - if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' }} - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.event.inputs.tag }} - name: ${{ github.event.inputs.tag }} - files: PiliPlus_android_*.apk - - - name: 上传 - uses: actions/upload-artifact@v7 - with: - archive: false - name: Android_arm64-v8a - path: PiliPlus_android_*_arm64-v8a.apk - - - name: 上传 - uses: actions/upload-artifact@v7 - with: - archive: false - name: Android_armeabi-v7a - path: PiliPlus_android_*_armeabi-v7a.apk - - - name: 上传 - uses: actions/upload-artifact@v7 - with: - archive: false - name: Android_x86_64 - path: PiliPlus_android_*_x86_64.apk - - ios: - if: ${{ (github.event_name == 'pull_request' && github.repository == 'bggRGjQaUbCoE/PiliPlus') || github.event.inputs.build_ios == 'true' }} - uses: ./.github/workflows/ios.yml - permissions: write-all - with: - tag: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || '' }} - - mac: - if: ${{ github.event.inputs.build_mac == 'true' }} - uses: ./.github/workflows/mac.yml - permissions: write-all - with: - tag: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || '' }} - - win_x64: - if: ${{ (github.event_name == 'pull_request' && github.repository == 'bggRGjQaUbCoE/PiliPlus') || github.event.inputs.build_win_x64 == 'true' }} - uses: ./.github/workflows/win_x64.yml - permissions: write-all - with: - tag: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || '' }} - - linux_x64: - if: ${{ github.event.inputs.build_linux_x64 == 'true' }} - uses: ./.github/workflows/linux_x64.yml - permissions: write-all - with: - tag: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || '' }} diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml deleted file mode 100644 index 629ae02efe..0000000000 --- a/.github/workflows/ios.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Build for iOS - -on: - workflow_call: - inputs: - tag: - description: "tag" - required: false - default: "" - type: string - workflow_dispatch: - -jobs: - build-macos-app: - name: Release IOS - runs-on: macos-latest - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Setup flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - flutter-version-file: pubspec.yaml - - - name: Set and Extract version - shell: pwsh - run: lib/scripts/build.ps1 - - - name: Apply Patch - shell: pwsh - run: lib/scripts/patch.ps1 iOS - continue-on-error: true - - - name: Build iOS - run: | - flutter build ios --release --no-codesign --dart-define-from-file=pili_release.json - ln -sf ./build/ios/iphoneos Payload - # make AltSign happy... - find Payload/Runner.app/Frameworks -type d -name "*.framework" -exec codesign --force --sign - --preserve-metadata=identifier,entitlements {} \; - zip -r9 PiliPlus_ios_${{env.version}}.ipa Payload/Runner.app - - - name: Release - if: ${{ github.event.inputs.tag != '' }} - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.event.inputs.tag }} - name: ${{ github.event.inputs.tag }} - files: | - PiliPlus_ios_*.ipa - - - name: Upload ios release - uses: actions/upload-artifact@v7 - with: - archive: false - name: iOS-release - path: PiliPlus_ios_*.ipa diff --git a/.github/workflows/linux_x64.yml b/.github/workflows/linux_x64.yml deleted file mode 100644 index 65ad9d269f..0000000000 --- a/.github/workflows/linux_x64.yml +++ /dev/null @@ -1,269 +0,0 @@ -name: Build for Linux x64 - -on: - workflow_call: - inputs: - tag: - description: "tag" - required: false - default: "" - type: string - workflow_dispatch: - -jobs: - build-linux-app: - name: Release Linux x64 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev unzip webkit2gtk-4.1 libasound2-dev rpm patchelf - sudo apt-get install -y gcc g++ autoconf automake debhelper glslang-dev ladspa-sdk xutils-dev libasound2-dev \ - libarchive-dev libbluray-dev libbs2b-dev libcaca-dev libcdio-paranoia-dev libdrm-dev \ - libdav1d-dev libdvdnav-dev libegl1-mesa-dev libepoxy-dev libfontconfig-dev libfreetype6-dev \ - libfribidi-dev libgl1-mesa-dev libgbm-dev libgme-dev libgsm1-dev libharfbuzz-dev libjpeg-dev \ - libbrotli-dev liblcms2-dev libmodplug-dev libmp3lame-dev libopenal-dev \ - libopus-dev libopencore-amrnb-dev libopencore-amrwb-dev libpulse-dev librtmp-dev \ - libsdl2-dev libsixel-dev libssh-dev libsoxr-dev libspeex-dev libtool \ - libv4l-dev libva-dev libvdpau-dev libvorbis-dev libvo-amrwbenc-dev \ - libunwind-dev libvpx-dev libwayland-dev libx11-dev libxext-dev \ - libxkbcommon-dev libxrandr-dev libxss-dev libxv-dev libxvidcore-dev \ - linux-libc-dev nasm ninja-build pkg-config python3 python3-docutils wayland-protocols \ - x11proto-core-dev zlib1g-dev libfdk-aac-dev libtheora-dev libwebp-dev \ - unixodbc-dev libpq-dev libxxhash-dev libaom-dev \ - libgtk-3-0 libblkid1 liblzma5 libmpv-dev - shell: bash - - - name: Setup flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - flutter-version-file: pubspec.yaml - cache: true - - - name: Set and Extract version - shell: pwsh - run: lib/scripts/build.ps1 - - - name: Apply Patch - shell: pwsh - run: lib/scripts/patch.ps1 Linux - continue-on-error: true - - #TODO: deb and rpm packages need to be build - - name: Build Linux - run: flutter build linux --release -v --pub --dart-define-from-file=pili_release.json - - - name: Package .tar.gz - run: tar -zcvf PiliPlus_linux_${{ env.version }}_amd64.tar.gz -C build/linux/x64/release/bundle . - - - name: Packege deb - run: | - printf "建立构建目录...\n" - mkdir "PiliPlus_linux_${{ env.version }}_amd64" - pushd "PiliPlus_linux_${{ env.version }}_amd64" - mkdir -p opt/PiliPlus - mkdir -p usr/share/applications - mkdir -p usr/share/icons/hicolor/512x512/apps - - printf "复制文件...\n" - cp -r ../build/linux/x64/release/bundle/* opt/PiliPlus - cp -r ../assets/linux/DEBIAN . - cp ../assets/linux/com.example.piliplus.desktop usr/share/applications - cp ../assets/images/logo/logo.png usr/share/icons/hicolor/512x512/apps/piliplus.png - - printf "修改控制文件...\n" - # 替换版本号 - sed -i "2s/version_need_change/${{ env.version }}/g" DEBIAN/control - # 计算安装大小并替换 - SIZE_KB=$(du -s -b --apparent-size . | awk '{print int($1)}') - SIZE_KB=$(($SIZE_KB - $(du -s -b --apparent-size DEBIAN | awk '{print int($1)}'))) - SIZE_KB=$(echo $SIZE_KB | awk '{print int($1/1024 + 0.999)}') - printf "\t安装大小: %s KB\n" "$SIZE_KB" - sed -i "9s/size_need_change/${SIZE_KB}/g" DEBIAN/control - - printf "生成并写入 md5sums ...\n" - md5sum opt/PiliPlus/piliplus >> DEBIAN/md5sums - md5sum opt/PiliPlus/lib/* >> DEBIAN/md5sums - md5sum opt/PiliPlus/data/icudtl.dat >> DEBIAN/md5sums - - printf "设置权限...\n" - chmod 0644 DEBIAN/control - chmod 0644 DEBIAN/md5sums - chmod 0755 DEBIAN/postinst - chmod 0755 DEBIAN/postrm - chmod 0755 DEBIAN/prerm - - printf "打包 deb 文件...\n" - popd - dpkg-deb --build --verbose --root-owner-group "PiliPlus_linux_${{ env.version }}_amd64" - printf "完成: PiliPlus_linux_%s_amd64.deb\n" "${{ env.version }}" - shell: bash - - - name: Packege rpm - run: | - printf "建立 RPM 构建目录...\n" - RPM_BUILD_ROOT="$PWD/rpm_build" - mkdir -p "$RPM_BUILD_ROOT/BUILD" "$RPM_BUILD_ROOT/RPMS" "$RPM_BUILD_ROOT/SOURCES" "$RPM_BUILD_ROOT/SPECS" "$RPM_BUILD_ROOT/SRPMS" - - printf "准备源码归档(仅包含运行时与元数据)...\n" - DATE="$(date '+%a %b %d %Y')" - SRC_DIR="$PWD/piliplus-${{ env.version }}" - mkdir -p "$SRC_DIR/bundle" "$SRC_DIR/assets" - cp -r build/linux/x64/release/bundle/* "$SRC_DIR/bundle/" - cp assets/linux/com.example.piliplus.desktop "$SRC_DIR/assets/com.example.piliplus.desktop" - cp assets/images/logo/logo.png "$SRC_DIR/assets/piliplus.png" - tar -zcvf "$RPM_BUILD_ROOT/SOURCES/piliplus-${{ env.version }}.tar.gz" -C "$PWD" "piliplus-${{ env.version }}" - - printf "生成 spec 文件...\n" - cat > "$RPM_BUILD_ROOT/SPECS/piliplus.spec" < "$APPDIR/AppRun" <<'APPRUN_EOF' - #!/bin/bash - SELF=$(readlink -f "$0") - HERE=${SELF%/*} - export PATH="${HERE}/usr/bin:${PATH}" - export LD_LIBRARY_PATH="${HERE}/usr/lib:${LD_LIBRARY_PATH}" - exec "${HERE}/usr/bin/piliplus" "$@" - APPRUN_EOF - chmod +x "$APPDIR/AppRun" - - printf "修改桌面文件中的 Exec 路径...\n" - sed -i 's|Exec=piliplus|Exec=piliplus|g' "$APPDIR/com.example.piliplus.desktop" - sed -i 's|Icon=piliplus|Icon=piliplus|g' "$APPDIR/com.example.piliplus.desktop" - - printf "打包 AppImage...\n" - ARCH=x86_64 ./appimagetool-x86_64.AppImage "$APPDIR" "PiliPlus_linux_${{ env.version }}_amd64.AppImage" - - printf "完成: PiliPlus_linux_%s_amd64.AppImage\n" "${{ env.version }}" - shell: bash - - - name: Release - if: ${{ github.event.inputs.tag != '' }} - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.event.inputs.tag }} - name: ${{ github.event.inputs.tag }} - files: | - PiliPlus_linux_*.tar.gz - PiliPlus_linux_*.deb - PiliPlus_linux_*.rpm - PiliPlus_linux_*.AppImage - - - name: Upload linux targz package - uses: actions/upload-artifact@v7 - with: - archive: false - name: Linux_targz_amd64_packege - path: PiliPlus_linux_*.tar.gz - - - name: Upload linux deb package - uses: actions/upload-artifact@v7 - with: - archive: false - name: Linux_deb_amd64_package - path: PiliPlus_linux_*.deb - - - name: Upload linux rpm package - uses: actions/upload-artifact@v7 - with: - archive: false - name: Linux_rpm_amd64_package - path: PiliPlus_linux_*.rpm - - - name: Upload linux AppImage package - uses: actions/upload-artifact@v7 - with: - archive: false - name: Linux_AppImage_amd64_package - path: PiliPlus_linux_*.AppImage diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml deleted file mode 100644 index 0996ac04e6..0000000000 --- a/.github/workflows/mac.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Build for Mac - -on: - workflow_call: - inputs: - tag: - description: "tag" - required: false - default: "" - type: string - workflow_dispatch: - -jobs: - build-mac-app: - name: Release Mac - runs-on: macos-latest - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Setup flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - flutter-version-file: pubspec.yaml - - - name: Set and Extract version - shell: pwsh - run: lib/scripts/build.ps1 - - - name: Apply Patch - shell: pwsh - run: lib/scripts/patch.ps1 macOS - continue-on-error: true - - - name: Build Mac - run: flutter build macos --release --dart-define-from-file=pili_release.json - - - name: Prepare Upload - run: | - npm install --global create-dmg - create-dmg build/macos/Build/Products/Release/PiliPlus.app || true - continue-on-error: true - - - name: Rename DMG - run: mv PiliPlus*.dmg PiliPlus_macos_${{ env.version }}.dmg - - - name: Release - if: ${{ github.event.inputs.tag != '' }} - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.event.inputs.tag }} - name: ${{ github.event.inputs.tag }} - files: | - PiliPlus_macos_*.dmg - - - name: Upload macos release - uses: actions/upload-artifact@v7 - with: - archive: false - name: macOS-release - path: PiliPlus_macos_*.dmg diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml new file mode 100644 index 0000000000..69540cc990 --- /dev/null +++ b/.github/workflows/pr_check.yml @@ -0,0 +1,38 @@ +name: pr_check + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + paths-ignore: + - 'static/**' + - '**.md' + - '.gitignore' + - '.github/ISSUE_TEMPLATE/**' + workflow_dispatch: + +jobs: + analyze: + name: Dart Analyze + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + flutter-version: "3.41.9" + cache: true + + - name: Get Flutter dependencies + run: flutter pub get + env: + GIT_LFS_SKIP_SMUDGE: 1 + + - name: Dart Analyze + run: dart analyze --no-fatal-warnings diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yml similarity index 77% rename from .github/workflows/release.yaml rename to .github/workflows/release.yml index 4486e557f4..fd7e773e44 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yml @@ -5,78 +5,83 @@ on: tags: - "*" workflow_dispatch: - inputs: - logLevel: - description: "Log level" - required: true - default: "warning" - type: choice - options: - - info - - warning - - debug jobs: - flutter_build_ohos: + release_ohos: name: Release for ohos runs-on: ubuntu-latest permissions: write-all steps: - - name: Maximize build disk space - uses: easimon/maximize-build-space@v10 - name: Clone repository uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Extract tag name - run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - shell: bash - - name: Echo build progress - run: echo "PiliPlus_ohos_${{ env.tag }}_unsigned.hap build progress" + run: | + if [[ "$GITHUB_REF" == refs/tags/* ]]; then + tag="${GITHUB_REF#refs/tags/}" + else + tag="$(git describe --tags --abbrev=0 2>/dev/null || echo '')" + fi + # sanitize slashes in tag/branch name for filename use + tag="${tag//\//-}" + echo "tag=${tag}" >> $GITHUB_ENV shell: bash + - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y curl xz-utils zip libglu1-mesa shell: bash + - name: Setup HarmonyOS toolchain uses: ErBWs/setup-ohos@v1 with: version: latest cache: true + - name: Setup JDK17 uses: actions/setup-java@v4 with: java-version: "17" distribution: "temurin" + - name: Setup flutter-ohos run: | git clone -b oh-3.41.9-release https://gitcode.com/CPF-Flutter/flutter_flutter.git $GITHUB_WORKSPACE/flutter echo "$GITHUB_WORKSPACE/flutter/bin" >> $GITHUB_PATH shell: bash + + - name: Generate env.json + run: dart .vscode/build_env.dart "${{ env.tag }}" + shell: bash + - name: Get Flutter dependencies run: flutter pub get shell: bash env: GIT_LFS_SKIP_SMUDGE: 1 - - name: Set and Extract version - shell: pwsh - run: lib/scripts/build.ps1 + - name: Rename package run: | sed -i "s/name: PiliPlus/name: piliplus/g" pubspec.yaml find lib -type f -name "*.dart" -exec sed -i "s/import 'package:PiliPlus/import 'package:piliplus/g" {} \; shell: bash + - name: Add ohos platform run: flutter create --platforms ohos . shell: bash + - name: Build Flutter for ohos - run: flutter build hap --release --dart-define-from-file=pili_release.json + run: flutter build hap --release --dart-define-from-file=.vscode/env.json shell: bash continue-on-error: true + - name: Package ohos build output run: cp ./ohos/entry/build/default/outputs/default/entry-default-unsigned.hap PiliPlus_ohos_${{ env.tag }}_unsigned.hap shell: bash + - name: Create release uses: softprops/action-gh-release@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 13a5bc32d4..0000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: build-test - -on: - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - paths-ignore: - - 'static/**' - - '**.md' - - '.gitignore' - - '.github/ISSUE_TEMPLATE/**' - workflow_dispatch: - inputs: - logLevel: - description: 'Log level' - required: true - default: 'warning' - type: choice - options: - - info - - warning - - debug - -jobs: - flutter_build_ohos: - name: Build for ohos - runs-on: ubuntu-latest - permissions: write-all - steps: - - name: Clone repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: 替换包名 - run: | - export LC_ALL=C - sed -i 's/com\.example\.piliplus/com\.example\.pilitest/g' \ - ohos/AppScope/app.json5 \ - lib/services/audio_handler.dart - shell: bash - - name: Extract tag name - run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - shell: bash - - name: Echo build progress - run: echo "PiliPlus_ohos_${{ env.tag }}_unsigned.hap build progress" - shell: bash - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y curl xz-utils zip libglu1-mesa - shell: bash - - name: Setup HarmonyOS toolchain - uses: ErBWs/setup-ohos@v1 - with: - version: latest - cache: true - - name: Setup JDK17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - name: Setup flutter-ohos - run: | - git clone -b oh-3.41.9-release https://gitcode.com/CPF-Flutter/flutter_flutter.git $GITHUB_WORKSPACE/flutter - echo "$GITHUB_WORKSPACE/flutter/bin" >> $GITHUB_PATH - shell: bash - - name: Get Flutter dependencies - run: flutter pub get - shell: bash - env: - GIT_LFS_SKIP_SMUDGE: 1 - - name: Set and Extract version - shell: pwsh - run: lib/scripts/build.ps1 - - name: Rename package - run: | - sed -i "s/name: PiliPlus/name: piliplus/g" pubspec.yaml - find lib -type f -name "*.dart" -exec sed -i "s/import 'package:PiliPlus/import 'package:piliplus/g" {} \; - shell: bash - - name: Add ohos platform - run: flutter create --platforms ohos . - shell: bash - - name: Build Flutter for ohos - run: flutter build hap --release --dart-define-from-file=pili_release.json - shell: bash - continue-on-error: true - - name: Package ohos build output - run: cp ./ohos/entry/build/default/outputs/default/entry-default-unsigned.hap PiliPlus_ohos_canary.hap - shell: bash - - name: Upload ohos outputs - uses: actions/upload-artifact@v4 - with: - name: ohos_outputs - path: PiliPlus_ohos_*.hap \ No newline at end of file diff --git a/.github/workflows/win_x64.yml b/.github/workflows/win_x64.yml deleted file mode 100644 index 42d90f2780..0000000000 --- a/.github/workflows/win_x64.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Build for Windows x64 - -on: - workflow_call: - inputs: - tag: - description: "tag" - required: false - default: "" - type: string - workflow_dispatch: - -jobs: - build-windows-app: - name: Release Windows x64 - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Setup flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - flutter-version-file: pubspec.yaml - - - name: Apply Patch - shell: pwsh - run: lib/scripts/patch.ps1 windows - continue-on-error: true - - - name: Add fastforge and Inno Setup - run: | - dart pub global activate fastforge - choco install innosetup - - - name: Add Chinese language file for Inno Setup - run: | - Copy-Item "windows/packaging/exe/ChineseSimplified.isl" "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl" - shell: pwsh - - - name: Set and Extract version - shell: pwsh - run: lib/scripts/build.ps1 - - - name: Build Windows - run: | - fastforge package --platform windows --targets exe --flutter-build-args="dart-define-from-file=pili_release.json" - - - name: Prepare Upload - run: | - mkdir -p Release/PiliPlus-Win - mkdir -p PiliPlus-Win-Setup - mv build/windows/x64/runner/Release/* Release/PiliPlus-Win/ - mv dist/**/*.exe PiliPlus-Win-Setup/PiliPlus_windows_${{env.version}}_x64_setup.exe - - - name: Compress - if: ${{ github.event.inputs.tag != '' }} - run: | - Compress-Archive -Path "Release/PiliPlus-Win" -DestinationPath "PiliPlus_windows_${{env.version}}_x64_portable.zip" - shell: pwsh - - - name: Release - if: ${{ github.event.inputs.tag != '' }} - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.event.inputs.tag }} - name: ${{ github.event.inputs.tag }} - files: | - PiliPlus_windows_*.zip - PiliPlus-Win-Setup/PiliPlus_windows_*.exe - - - name: Upload windows file release - uses: actions/upload-artifact@v7 - with: - archive: true - name: PiliPlus_windows_${{env.version}}_x64_portable - path: Release - - - name: Upload windows setup release - uses: actions/upload-artifact@v7 - with: - archive: false - name: Windows-setup-x64-release - path: PiliPlus-Win-Setup/PiliPlus_windows_*.exe diff --git a/lib/scripts/build.ps1 b/lib/scripts/build.ps1 deleted file mode 100644 index cfa23754c8..0000000000 --- a/lib/scripts/build.ps1 +++ /dev/null @@ -1,57 +0,0 @@ -param( - [string]$Arg = '' -) - -try { - $versionName = $null - - $versionCode = [int](git rev-list --count HEAD).Trim() - - $commitHash = (git rev-parse HEAD).Trim() - - $updatedContent = foreach ($line in (Get-Content -Path 'pubspec.yaml' -Encoding UTF8)) { - if ($line -match '^\s*version:\s*([\d\.]+)') { - $versionName = $matches[1] - if ($Arg -eq 'android') { - $versionName += '-' + $commitHash.Substring(0, 9) - } - "version: $versionName+$versionCode" - } - else { - $line - } - } - - if ($null -eq $versionName) { - throw 'version not found' - } - - $updatedContent | Set-Content -Path 'pubspec.yaml' -Encoding UTF8 - - $buildTime = [int]([DateTimeOffset]::Now.ToUnixTimeSeconds()) - - $tag = $env:GITHUB_REF_NAME - if ($null -eq $tag) { - $tag = $env:GITHUB_EVENT_INPUTS_TAG - } - if ($null -eq $tag -or $tag -eq '') { - $tag = 'N/A' - } - - $data = @{ - 'pili.name' = $versionName - 'pili.code' = $versionCode - 'pili.hash' = $commitHash - 'pili.time' = $buildTime - 'pili.tag' = $tag - 'ENABLE_FLEX_OVERFLOW' = 'false' - } - - $data | ConvertTo-Json -Compress | Out-File 'pili_release.json' -Encoding UTF8 - - Add-Content -Path $env:GITHUB_ENV -Value "version=$versionName+$versionCode" -} -catch { - Write-Error "Prebuild Error: $($_.Exception.Message)" - exit 1 -} \ No newline at end of file diff --git a/lib/scripts/patch.ps1 b/lib/scripts/patch.ps1 deleted file mode 100644 index 139641c3cc..0000000000 --- a/lib/scripts/patch.ps1 +++ /dev/null @@ -1,75 +0,0 @@ -param( - [string]$platform = "" -) - -# TODO: remove -# https://github.com/flutter/flutter/issues/182468 -$ToolTipFix = "56956c33ef102ac0b5fc46b62bd2dd9f50a86616"; - -# TODO: remove -# https://github.com/flutter/flutter/issues/182281 -$NewOverScrollIndicator = "362b1de29974ffc1ed6faa826e1df870d7bec75f"; - -$BottomSheetPatch = "lib/scripts/bottom_sheet.patch" -# TODO: remove -# https://github.com/flutter/flutter/issues/90223 -$ModalBarrierPatch = "lib/scripts/modal_barrier.patch" -# TODO: remove -# https://github.com/flutter/flutter/issues/182466 -$MouseCursorPatch = "lib/scripts/mouse_cursor.patch" - -Set-Location $env:FLUTTER_ROOT - -$picks = @() -$reverts = @() -$patches = @($ModalBarrierPatch, $MouseCursorPatch) - -switch ($platform.ToLower()) { - "android" { - $reverts += $NewOverScrollIndicator - $patches += $BottomSheetPatch - } - "ios" {} - "linux" { - $picks += $ToolTipFix - } - "macos" { - $picks += $ToolTipFix - } - "windows" { - $picks += $ToolTipFix - } - default {} -} - -git config --global user.name "ci" -git config --global user.email "example@example.com" - -git reset --hard HEAD - -foreach ($pick in $picks) { - git stash - git cherry-pick $pick --no-edit - if ($LASTEXITCODE -eq 0) { - git reset --soft HEAD~1 - Write-Host "$pick picked" - } - git stash pop -} - -foreach ($revert in $reverts) { - git stash - git revert $revert --no-edit - if ($LASTEXITCODE -eq 0) { - git reset --soft HEAD~1 - Write-Host "$revert reverted" - } - git stash pop -} - -foreach ($patch in $patches) { - git apply "$env:GITHUB_WORKSPACE/$patch" - if ($LASTEXITCODE -eq 0) { - Write-Host "$patch applied" - } -}