diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 493e0ec5df..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,168 +0,0 @@ -name: Build - -on: - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - paths-ignore: - - "**.md" - 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: false - type: boolean - - tag: - description: "tag" - required: false - default: "" - type: string - -jobs: - android: - if: ${{ github.event_name == 'pull_request' || 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 bottom sheet patch - working-directory: ${{ env.FLUTTER_ROOT }} - run: git apply $GITHUB_WORKSPACE/lib/scripts/bottom_sheet_patch.diff - 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 - shell: pwsh - run: lib/scripts/build.ps1 android - - - name: flutter build apk - run: flutter build apk --release --split-per-abi --dart-define-from-file=pili_release.json --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@v5 - with: - name: Android_arm64-v8a - path: | - PiliPlus_android_*_arm64-v8a.apk - - - name: 上传 - uses: actions/upload-artifact@v5 - with: - name: Android_armeabi-v7a - path: | - PiliPlus_android_*_armeabi-v7a.apk - - - name: 上传 - uses: actions/upload-artifact@v5 - with: - name: Android_x86_64 - path: | - PiliPlus_android_*_x86_64.apk - - ios: - if: ${{ github.event_name == 'pull_request' || 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_name == 'pull_request' || 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.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_name == 'pull_request' || 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 8f87246591..0000000000 --- a/.github/workflows/ios.yml +++ /dev/null @@ -1,52 +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: Build iOS - run: | - flutter build ios --release --no-codesign --dart-define-from-file=pili_release.json - ln -sf ./build/ios/iphoneos Payload - 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@v5 - with: - 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 a12b4b90d5..0000000000 --- a/.github/workflows/linux_x64.yml +++ /dev/null @@ -1,260 +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 - - #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/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/piliplus.desktop "$SRC_DIR/assets/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/piliplus.desktop" - sed -i 's|Icon=piliplus|Icon=piliplus|g' "$APPDIR/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@v5 - with: - name: Linux_targz_amd64_packege - path: PiliPlus_linux_*.tar.gz - - - name: Upload linux deb package - uses: actions/upload-artifact@v5 - with: - name: Linux_deb_amd64_package - path: PiliPlus_linux_*.deb - - - name: Upload linux rpm package - uses: actions/upload-artifact@v5 - with: - name: Linux_rpm_amd64_package - path: PiliPlus_linux_*.rpm - - - name: Upload linux AppImage package - uses: actions/upload-artifact@v5 - with: - 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 624adfd059..0000000000 --- a/.github/workflows/mac.yml +++ /dev/null @@ -1,58 +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: 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 - 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@v5 - with: - name: macOS-release - path: PiliPlus_macos_*.dmg diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000000..a2453edbc1 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,80 @@ +name: release + +on: + push: + tags: + - "*" + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + +jobs: + flutter_build_ohos: + name: Release for ohos + runs-on: ubuntu-latest + permissions: write-all + steps: + - 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" + 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.35.7-dev https://gitcode.com/openharmony-tpc/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: 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_${{ env.tag }}_unsigned.hap + shell: bash + - name: Create release + uses: softprops/action-gh-release@v2 + with: + name: ${{ env.tag }}-ohos + draft: true + files: PiliPlus_ohos_*.hap \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..c1f322ea11 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,81 @@ +name: build + +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: 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.35.7-dev https://gitcode.com/openharmony-tpc/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: 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 a91c96cbc5..0000000000 --- a/.github/workflows/win_x64.yml +++ /dev/null @@ -1,80 +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: 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.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@v5 - with: - name: Windows-file-x64-release - path: Release - - - name: Upload windows setup release - uses: actions/upload-artifact@v5 - with: - name: Windows-setup-x64-release - path: PiliPlus-Win-Setup diff --git a/lib/build_config.dart b/lib/build_config.dart index f77eff9873..c4435080c8 100644 --- a/lib/build_config.dart +++ b/lib/build_config.dart @@ -7,6 +7,10 @@ class BuildConfig { 'pili.name', defaultValue: 'SNAPSHOT', ); + static const String versionTag = String.fromEnvironment( + 'pili.tag', + defaultValue: 'N/A', + ); static const int buildTime = int.fromEnvironment('pili.time'); static const String commitHash = String.fromEnvironment( diff --git a/lib/pages/about/view.dart b/lib/pages/about/view.dart index 28dd57c1d1..ddcc7e5aba 100644 --- a/lib/pages/about/view.dart +++ b/lib/pages/about/view.dart @@ -41,6 +41,8 @@ class AboutPage extends StatefulWidget { class _AboutPageState extends State { final currentVersion = '${BuildConfig.versionName}+${BuildConfig.versionCode}'; + final versionTag = + '${BuildConfig.versionTag}+${BuildConfig.versionCode}'; RxString cacheSize = ''.obs; late int _pressCount = 0; @@ -136,14 +138,14 @@ class _AboutPageState extends State { ), ListTile( onTap: () => Update.checkUpdate(false), - onLongPress: () => Utils.copyText(currentVersion), + onLongPress: () => Utils.copyText(versionTag), onSecondaryTap: Utils.isMobile ? null - : () => Utils.copyText(currentVersion), + : () => Utils.copyText(versionTag), title: const Text('当前版本'), leading: const Icon(Icons.commit_outlined), trailing: Text( - currentVersion, + versionTag, style: subTitleStyle, ), ), diff --git a/lib/scripts/build.ps1 b/lib/scripts/build.ps1 index c37c91012c..ccc337b9f8 100644 --- a/lib/scripts/build.ps1 +++ b/lib/scripts/build.ps1 @@ -30,11 +30,20 @@ try { $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 } $data | ConvertTo-Json -Compress | Out-File 'pili_release.json' -Encoding UTF8