From ea13e5aef60a55416bebedd76e64bb9ec39f6f53 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Wed, 11 Dec 2024 22:45:42 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dx64=20native=E7=BC=96?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 497 +++++++++++++++++----------------- scripts/setNative.ps1 | 47 ++++ 2 files changed, 293 insertions(+), 251 deletions(-) create mode 100644 scripts/setNative.ps1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c32b160f..ae41e059 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,32 +3,32 @@ name: Release on: workflow_dispatch: inputs: - version: - description: '版本号' + version: + description: "版本号" required: true - default: '0.0.0.0' + default: "0.0.0.0" enableX64: - description: '启用x64' + description: "启用x64" required: true default: true type: boolean enableX64Native: - description: '启用x64Native' + description: "启用x64Native" required: true default: true type: boolean enableX86: - description: '启用x86' + description: "启用x86" required: true default: false type: boolean enableArm64: - description: '启用Arm64' + description: "启用Arm64" required: true default: true type: boolean enableArm32: - description: '启用Arm32' + description: "启用Arm32" required: true default: false type: boolean @@ -53,246 +53,241 @@ jobs: nuget_package: biliuwp-lite-nuget-packages.zip steps: - - - name: Configure Pagefile - uses: al-cheb/configure-pagefile-action@v1.2 - with: - minimum-size: 32GB - maximum-size: 32GB - disk-root: "C:" - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: EchoInput - run: | - echo 启用x64编译 ${{ github.event.inputs.enableX64 }} - echo 启用x86编译 ${{ github.event.inputs.enableX86 }} - echo 启用Arm64编译 ${{ github.event.inputs.enableArm64 }} - echo 启用Arm编译 ${{ github.event.inputs.enableArm32 }} - - - name: Download and process necessary files - run: | - curl --location $env:Webdav_addr --header "$env:Webdav_auth" -o "$env:UWP_Project_Directory/$env:SigningCertificate" --insecure - curl --location $env:nuget_package_addr --header "$env:Webdav_auth" -o "$env:nuget_package" --insecure - Expand-Archive -path $env:nuget_package -DestinationPath ./ - cp -r ./packages ./src/ - - - uses: release-drafter/release-drafter@v5 - name: Create release draft - id: release-drafter - - - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v1.0.3 - - - name: Windows SDK Install - uses: ChristopheLav/windows-sdk-install@v1.0.1 - with: - version-sdk: 18362 - features: 'OptionId.WindowsPerformanceToolkit,OptionId.WindowsDesktopDebuggers,OptionId.AvrfExternal,OptionId.NetFxSoftwareDevelopmentKit,OptionId.WindowsSoftwareLogoToolkit,OptionId.IpOverUsb,OptionId.MSIInstallTools,OptionId.SigningTools,OptionId.UWPManaged,OptionId.UWPCPP,OptionId.UWPLocalized,OptionId.DesktopCPPx86,OptionId.DesktopCPPx64,OptionId.DesktopCPParm,OptionId.DesktopCPParm64' - - - name: Update manifest version - run: | - [xml]$manifest = get-content ".\$env:UWP_Project_Directory\Package.appxmanifest" - $manifest.Package.Identity.Version = "${{github.event.inputs.version}}" - $manifest.save(".\$env:UWP_Project_Directory\Package.appxmanifest") - - - name: Create Package Directory - run: New-Item -ItemType Directory -Path C:\Package - - - name: document processing - run: | - git clone https://github.com/ywmoyue/OnlinePageToPDF-Node.git - cd OnlinePageToPDF-Node - npm install - node index.js --waitTime=35000 --pageUrl="http://markdown.muyan233.top:352/?fileUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fywmoyue%2Fbiliuwp-lite%2Fdev%2Fdocument%2Finstall-readme.md" --pdfFilePath="安装教程.pdf" - cd .. - cp ./OnlinePageToPDF-Node/安装教程.pdf C:\Package\安装教程.pdf - - - name: Build x64 - run: | - msbuild $env:UWP_Project_Directory /p:Platform=x64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore - env: - BuildMode: SideloadOnly - Configuration: Release - if: github.event.inputs.enableX64 == 'true' - - - name: copy x64 document - run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test\安装教程.pdf - if: github.event.inputs.enableX64 == 'true' - - - name: Remove x64 useless files - run: | - cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test - rm -r -fo *.appxsym - cd Dependencies - rm -r -fo arm,arm64,x86 - if: github.event.inputs.enableX64 == 'true' - - - name: Create x64 archive - run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64.zip - if: github.event.inputs.enableX64 == 'true' - - - name: Update x64 release asset - id: upload-release-asset-x64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} - if: github.event.inputs.enableX64 == 'true' - with: - upload_url: ${{ steps.release-drafter.outputs.upload_url }} - asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64.zip - asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x64.zip - asset_content_type: application/zip - - - - - name: Set x64 native - run: | - rm $env:UWP_Project_Path - cp $env:UWP_X64_Native_Project_Path $env:UWP_Project_Path - if: github.event.inputs.enableX64Native == 'true' - - - name: Build x64 native - run: | - msbuild $env:UWP_Project_Directory /p:Platform=x64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore - env: - BuildMode: SideloadOnly - Configuration: Release - if: github.event.inputs.enableX64Native == 'true' - - - name: copy x64 native document - run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test\安装教程.pdf - if: github.event.inputs.enableX64Native == 'true' - - - name: Remove x64 native useless files - run: | - cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test - rm -r -fo *.appxsym - cd Dependencies - rm -r -fo arm,arm64,x86 - if: github.event.inputs.enableX64Native == 'true' - - - name: Create x64 native archive - run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip - if: github.event.inputs.enableX64Native == 'true' - - - name: Update x64 native release asset - id: upload-release-asset-x64-native - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} - if: github.event.inputs.enableX64Native == 'true' - with: - upload_url: ${{ steps.release-drafter.outputs.upload_url }} - asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip - asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip - asset_content_type: application/zip - - - - name: Build x86 - run: msbuild $env:UWP_Project_Directory /p:Platform=x86 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore - if: github.event.inputs.enableX86 == 'true' - env: - BuildMode: SideloadOnly - Configuration: Release - - - name: copy x86 document - run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test\安装教程.pdf - if: github.event.inputs.enableX86 == 'true' - - - name: Remove x86 useless files - run: | - cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test - rm -r -fo *.appxsym - cd Dependencies - rm -r -fo arm,arm64,x64 - if: github.event.inputs.enableX86 == 'true' - - - name: Create x86 archive - run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x86.zip - if: github.event.inputs.enableX86 == 'true' - - - name: Update x86 release asset - id: upload-release-asset-x86 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} - if: github.event.inputs.enableX86 == 'true' - with: - upload_url: ${{ steps.release-drafter.outputs.upload_url }} - asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x86.zip - asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x86.zip - asset_content_type: application/zip - - - name: Build ARM64 - run: msbuild $env:UWP_Project_Directory /p:Platform=ARM64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore - if: github.event.inputs.enableArm64 == 'true' - env: - BuildMode: SideloadOnly - Configuration: Release - - - name: copy arm64 document - run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test\安装教程.pdf - if: github.event.inputs.enableArm64 == 'true' - - - name: Remove arm64 useless files - run: | - cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test - rm -r -fo *.appxsym - cd Dependencies - rm -r -fo arm,x64,x86 - if: github.event.inputs.enableArm64 == 'true' - - - name: Create ARM64 archive - run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip - if: github.event.inputs.enableArm64 == 'true' - - - name: Update ARM64 release asset - id: upload-release-asset-ARM64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} - if: github.event.inputs.enableArm64 == 'true' - with: - upload_url: ${{ steps.release-drafter.outputs.upload_url }} - asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip - asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip - asset_content_type: application/zip - - - name: Build ARM32 - run: msbuild $env:UWP_Project_Directory /p:Platform=ARM /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore - if: github.event.inputs.enableArm32 == 'true' - env: - BuildMode: SideloadOnly - Configuration: Release - - - name: copy arm32 document - run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test\安装教程.pdf - if: github.event.inputs.enableArm32 == 'true' - - - name: Remove arm32 useless files - run: | - cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test - rm -r -fo *.appxsym - cd Dependencies - rm -r -fo arm64,x64,x86 - if: github.event.inputs.enableArm32 == 'true' - - - name: Create ARM32 archive - run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip - if: github.event.inputs.enableArm32 == 'true' - - - name: Update ARM32 release asset - id: upload-release-asset-ARM32 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} - if: github.event.inputs.enableArm32 == 'true' - with: - upload_url: ${{ steps.release-drafter.outputs.upload_url }} - asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip - asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip - asset_content_type: application/zip + - name: Configure Pagefile + uses: al-cheb/configure-pagefile-action@v1.2 + with: + minimum-size: 32GB + maximum-size: 32GB + disk-root: "C:" + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: EchoInput + run: | + echo 启用x64编译 ${{ github.event.inputs.enableX64 }} + echo 启用x86编译 ${{ github.event.inputs.enableX86 }} + echo 启用Arm64编译 ${{ github.event.inputs.enableArm64 }} + echo 启用Arm编译 ${{ github.event.inputs.enableArm32 }} + + - name: Download and process necessary files + run: | + curl --location $env:Webdav_addr --header "$env:Webdav_auth" -o "$env:UWP_Project_Directory/$env:SigningCertificate" --insecure + curl --location $env:nuget_package_addr --header "$env:Webdav_auth" -o "$env:nuget_package" --insecure + Expand-Archive -path $env:nuget_package -DestinationPath ./ + cp -r ./packages ./src/ + + - uses: release-drafter/release-drafter@v5 + name: Create release draft + id: release-drafter + + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.3 + + - name: Windows SDK Install + uses: ChristopheLav/windows-sdk-install@v1.0.1 + with: + version-sdk: 18362 + features: "OptionId.WindowsPerformanceToolkit,OptionId.WindowsDesktopDebuggers,OptionId.AvrfExternal,OptionId.NetFxSoftwareDevelopmentKit,OptionId.WindowsSoftwareLogoToolkit,OptionId.IpOverUsb,OptionId.MSIInstallTools,OptionId.SigningTools,OptionId.UWPManaged,OptionId.UWPCPP,OptionId.UWPLocalized,OptionId.DesktopCPPx86,OptionId.DesktopCPPx64,OptionId.DesktopCPParm,OptionId.DesktopCPParm64" + + - name: Update manifest version + run: | + [xml]$manifest = get-content ".\$env:UWP_Project_Directory\Package.appxmanifest" + $manifest.Package.Identity.Version = "${{github.event.inputs.version}}" + $manifest.save(".\$env:UWP_Project_Directory\Package.appxmanifest") + + - name: Create Package Directory + run: New-Item -ItemType Directory -Path C:\Package + + - name: document processing + run: | + git clone https://github.com/ywmoyue/OnlinePageToPDF-Node.git + cd OnlinePageToPDF-Node + npm install + node index.js --waitTime=35000 --pageUrl="http://markdown.muyan233.top:352/?fileUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fywmoyue%2Fbiliuwp-lite%2Fdev%2Fdocument%2Finstall-readme.md" --pdfFilePath="安装教程.pdf" + cd .. + cp ./OnlinePageToPDF-Node/安装教程.pdf C:\Package\安装教程.pdf + + - name: Build x64 + run: | + msbuild $env:UWP_Project_Directory /p:Platform=x64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore + env: + BuildMode: SideloadOnly + Configuration: Release + if: github.event.inputs.enableX64 == 'true' + + - name: copy x64 document + run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test\安装教程.pdf + if: github.event.inputs.enableX64 == 'true' + + - name: Remove x64 useless files + run: | + cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test + rm -r -fo *.appxsym + cd Dependencies + rm -r -fo arm,arm64,x86 + if: github.event.inputs.enableX64 == 'true' + + - name: Create x64 archive + run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64.zip + if: github.event.inputs.enableX64 == 'true' + + - name: Update x64 release asset + id: upload-release-asset-x64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + if: github.event.inputs.enableX64 == 'true' + with: + upload_url: ${{ steps.release-drafter.outputs.upload_url }} + asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64.zip + asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x64.zip + asset_content_type: application/zip + + - name: Set x64 native + run: | + ./scripts/setNative.ps1 -csprojPath $env:UWP_Project_Path + if: github.event.inputs.enableX64Native == 'true' + + - name: Build x64 native + run: | + msbuild $env:UWP_Project_Directory /p:Platform=x64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore /p:Use64BitCompiler=true + env: + BuildMode: SideloadOnly + Configuration: Release + if: github.event.inputs.enableX64Native == 'true' + + - name: copy x64 native document + run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test\安装教程.pdf + if: github.event.inputs.enableX64Native == 'true' + + - name: Remove x64 native useless files + run: | + cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test + rm -r -fo *.appxsym + cd Dependencies + rm -r -fo arm,arm64,x86 + if: github.event.inputs.enableX64Native == 'true' + + - name: Create x64 native archive + run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip + if: github.event.inputs.enableX64Native == 'true' + + - name: Update x64 native release asset + id: upload-release-asset-x64-native + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + if: github.event.inputs.enableX64Native == 'true' + with: + upload_url: ${{ steps.release-drafter.outputs.upload_url }} + asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip + asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip + asset_content_type: application/zip + + - name: Build x86 + run: msbuild $env:UWP_Project_Directory /p:Platform=x86 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore + if: github.event.inputs.enableX86 == 'true' + env: + BuildMode: SideloadOnly + Configuration: Release + + - name: copy x86 document + run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test\安装教程.pdf + if: github.event.inputs.enableX86 == 'true' + + - name: Remove x86 useless files + run: | + cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test + rm -r -fo *.appxsym + cd Dependencies + rm -r -fo arm,arm64,x64 + if: github.event.inputs.enableX86 == 'true' + + - name: Create x86 archive + run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x86.zip + if: github.event.inputs.enableX86 == 'true' + + - name: Update x86 release asset + id: upload-release-asset-x86 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + if: github.event.inputs.enableX86 == 'true' + with: + upload_url: ${{ steps.release-drafter.outputs.upload_url }} + asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x86.zip + asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x86.zip + asset_content_type: application/zip + + - name: Build ARM64 + run: msbuild $env:UWP_Project_Directory /p:Platform=ARM64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore + if: github.event.inputs.enableArm64 == 'true' + env: + BuildMode: SideloadOnly + Configuration: Release + + - name: copy arm64 document + run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test\安装教程.pdf + if: github.event.inputs.enableArm64 == 'true' + + - name: Remove arm64 useless files + run: | + cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test + rm -r -fo *.appxsym + cd Dependencies + rm -r -fo arm,x64,x86 + if: github.event.inputs.enableArm64 == 'true' + + - name: Create ARM64 archive + run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip + if: github.event.inputs.enableArm64 == 'true' + + - name: Update ARM64 release asset + id: upload-release-asset-ARM64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + if: github.event.inputs.enableArm64 == 'true' + with: + upload_url: ${{ steps.release-drafter.outputs.upload_url }} + asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip + asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip + asset_content_type: application/zip + + - name: Build ARM32 + run: msbuild $env:UWP_Project_Directory /p:Platform=ARM /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore + if: github.event.inputs.enableArm32 == 'true' + env: + BuildMode: SideloadOnly + Configuration: Release + + - name: copy arm32 document + run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test\安装教程.pdf + if: github.event.inputs.enableArm32 == 'true' + + - name: Remove arm32 useless files + run: | + cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test + rm -r -fo *.appxsym + cd Dependencies + rm -r -fo arm64,x64,x86 + if: github.event.inputs.enableArm32 == 'true' + + - name: Create ARM32 archive + run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip + if: github.event.inputs.enableArm32 == 'true' + + - name: Update ARM32 release asset + id: upload-release-asset-ARM32 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + if: github.event.inputs.enableArm32 == 'true' + with: + upload_url: ${{ steps.release-drafter.outputs.upload_url }} + asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip + asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip + asset_content_type: application/zip diff --git a/scripts/setNative.ps1 b/scripts/setNative.ps1 new file mode 100644 index 00000000..f6cc6cef --- /dev/null +++ b/scripts/setNative.ps1 @@ -0,0 +1,47 @@ +param ( + [string]$csprojPath +) + +# Check if the input file exists +if (-not (Test-Path $csprojPath)) { + Write-Error "File not found: $csprojPath" + exit 1 +} + +# Read the content of the csproj file with UTF-8 encoding +$csprojContent = Get-Content -Path $csprojPath -Raw -Encoding UTF8 + +# Define the target PropertyGroup condition +# Use backticks to escape the $ character +$targetCondition = "'`$(Configuration)|`$(Platform)' == 'Release|x64'" + +# Find the PropertyGroup with the target condition +$propertyGroupRegex = [regex]::Escape("") + ".*?" + [regex]::Escape("") +$propertyGroupMatch = [regex]::Match($csprojContent, $propertyGroupRegex, [Text.RegularExpressions.RegexOptions]::Singleline) + +if ($propertyGroupMatch.Success) { + # Extract the PropertyGroup content + $propertyGroupContent = $propertyGroupMatch.Value + + # Check if UseDotNetNativeToolchain exists in the PropertyGroup + $useDotNetNativeToolchainRegex = [regex]::Escape("") + ".*?" + [regex]::Escape("") + $useDotNetNativeToolchainMatch = [regex]::Match($propertyGroupContent, $useDotNetNativeToolchainRegex) + + if ($useDotNetNativeToolchainMatch.Success) { + # Replace the value of UseDotNetNativeToolchain with true + $updatedPropertyGroupContent = $propertyGroupContent -replace $useDotNetNativeToolchainRegex, "true" + } else { + # If UseDotNetNativeToolchain doesn't exist, add it + $updatedPropertyGroupContent = $propertyGroupContent -replace "", "true" + } + + # Replace the original PropertyGroup with the updated one + $csprojContent = $csprojContent -replace [regex]::Escape($propertyGroupContent), $updatedPropertyGroupContent + + # Write the updated content back to the file with UTF-8 encoding + Set-Content -Path $csprojPath -Value $csprojContent -Encoding UTF8 + + Write-Host "Updated UseDotNetNativeToolchain to true in the PropertyGroup with condition '$targetCondition'." +} else { + Write-Warning "PropertyGroup with condition '$targetCondition' not found in the csproj file." +} \ No newline at end of file From 5a0a96f6eb77220f29a0a9872bbbfcfcb76b6ce0 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Sat, 14 Dec 2024 18:14:47 +0800 Subject: [PATCH 2/4] =?UTF-8?q?#940=20=E8=A7=86=E9=A2=91=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E5=88=86=E4=BA=AB=E6=8C=89=E9=92=AE=E4=B8=AD=E6=8F=90?= =?UTF-8?q?=E4=BE=9Bav=E5=8F=B7=E5=8F=AF=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Pages/VideoDetailPage.xaml | 1 + src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml index 4782835b..f423f9e8 100644 --- a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml +++ b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml @@ -44,6 +44,7 @@ + diff --git a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs index 7dfefe91..ae203c4d 100644 --- a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs +++ b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs @@ -746,5 +746,10 @@ private void Pivot_OnPreviewKeyDown(object sender, KeyRoutedEventArgs e) e.OriginalSource.GetType() != typeof(TextBox)) e.Handled = true; } + + private void BtnCopyAvId_OnClick(object sender, RoutedEventArgs e) + { + ("av" + m_viewModel.VideoInfo.Aid).SetClipboard(); + } } } From 570c4ef7fe8c8d1d8dab7f1ed9ac886a17031ca5 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Sat, 14 Dec 2024 18:15:39 +0800 Subject: [PATCH 3/4] =?UTF-8?q?#939=20=E4=B8=8B=E8=BD=BD=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E9=A1=B5=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/Common/ComboBoxItemData.cs | 7 ++++ src/BiliLite.UWP/Models/Common/Enumerates.cs | 9 ++++ src/BiliLite.UWP/Pages/DownloadPage.xaml | 13 ++++++ src/BiliLite.UWP/Pages/DownloadPage.xaml.cs | 20 +++++++++ src/BiliLite.UWP/Services/DownloadService.cs | 41 +++++++++++++++++-- .../Download/DownloadPageViewModel.cs | 9 ++++ 6 files changed, 95 insertions(+), 4 deletions(-) diff --git a/src/BiliLite.UWP/Models/Common/ComboBoxItemData.cs b/src/BiliLite.UWP/Models/Common/ComboBoxItemData.cs index 3e5b070a..d2138704 100644 --- a/src/BiliLite.UWP/Models/Common/ComboBoxItemData.cs +++ b/src/BiliLite.UWP/Models/Common/ComboBoxItemData.cs @@ -6,4 +6,11 @@ public class ComboBoxItemData public int Value { get; set; } } + + public class ComboBoxItemData + { + public string Text { get; set; } + + public T Value { get; set; } + } } diff --git a/src/BiliLite.UWP/Models/Common/Enumerates.cs b/src/BiliLite.UWP/Models/Common/Enumerates.cs index 31112504..46011dc6 100644 --- a/src/BiliLite.UWP/Models/Common/Enumerates.cs +++ b/src/BiliLite.UWP/Models/Common/Enumerates.cs @@ -571,4 +571,13 @@ public enum IndexSeasonType TV = 5, Variety = 7 } + + public enum DownloadedSortMode + { + Default, + TimeDesc, + TimeAsc, + TitleDesc, + TitleAsc, + } } \ No newline at end of file diff --git a/src/BiliLite.UWP/Pages/DownloadPage.xaml b/src/BiliLite.UWP/Pages/DownloadPage.xaml index 0b3d8cde..b5f2bbd2 100644 --- a/src/BiliLite.UWP/Pages/DownloadPage.xaml +++ b/src/BiliLite.UWP/Pages/DownloadPage.xaml @@ -34,6 +34,19 @@ % + + + + + [] m_sortOptions = new ComboBoxItemData[] + { + new() { Text = "默认", Value = DownloadedSortMode.Default }, + new() { Text = "时间倒序", Value = DownloadedSortMode.TimeDesc }, + new() { Text = "时间顺序", Value = DownloadedSortMode.TimeAsc }, + new() { Text = "标题顺序", Value = DownloadedSortMode.TitleAsc }, + new() { Text = "标题倒序", Value = DownloadedSortMode.TitleDesc }, + }; public DownloadPage() { @@ -46,6 +54,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) public async Task Refresh() { + CbSortMode.SelectedIndex = 0; m_downloadService.RefreshDownloaded(); } @@ -350,5 +359,16 @@ private void BtnResumeSubItem_OnClick(object sender, RoutedEventArgs e) m_downloadService.ResumeItem(item); } } + + private void BtnClearSearch_OnClick(object sender, RoutedEventArgs e) + { + m_downloadService.SearchDownloaded(""); + DownloadPivot.SelectedIndex = 1; + } + + private void SortOptions_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + m_downloadService.SetDownloadedSortMode((DownloadedSortMode)CbSortMode.SelectedValue); + } } } diff --git a/src/BiliLite.UWP/Services/DownloadService.cs b/src/BiliLite.UWP/Services/DownloadService.cs index ff1dbc86..5ff38a92 100644 --- a/src/BiliLite.UWP/Services/DownloadService.cs +++ b/src/BiliLite.UWP/Services/DownloadService.cs @@ -335,6 +335,30 @@ private async Task LoadDownloadFromIndex() m_downloadPageViewModel.DownloadedViewModels = new ObservableCollection(downloadedItems); } + private IEnumerable QueryDownloaded() + { + var query = m_downloadPageViewModel.Downloadeds.AsEnumerable(); + + // 提前处理搜索条件 + var searchKeyword = m_downloadPageViewModel.SearchKeyword?.ToLower(); + if (!string.IsNullOrEmpty(searchKeyword)) + { + query = query.Where(x => x.Title.ToLower().Contains(searchKeyword)); + } + + // 使用 switch 表达式简化排序逻辑 + query = m_downloadPageViewModel.DownloadedSortMode switch + { + DownloadedSortMode.TimeDesc => query.OrderByDescending(x => x.UpdateTime), + DownloadedSortMode.TimeAsc => query.OrderBy(x => x.UpdateTime), + DownloadedSortMode.TitleDesc => query.OrderByDescending(x => x.Title), + DownloadedSortMode.TitleAsc => query.OrderBy(x => x.Title), + _ => query // 默认不排序 + }; + + return query; + } + #endregion #region Public Methods @@ -428,8 +452,10 @@ public void RefreshDownloaded() public void SearchDownloaded(string keyword) { - var searchResult = m_downloadPageViewModel.Downloadeds - .Where(x => x.Title.ToLower().Contains(keyword.ToLower())).ToList(); + m_downloadPageViewModel.SearchKeyword = keyword; + m_downloadPageViewModel.IsSearching = !string.IsNullOrEmpty(keyword); + + var searchResult = QueryDownloaded(); m_downloadPageViewModel.DownloadedViewModels.Clear(); m_downloadPageViewModel.DownloadedViewModels.AddRange(searchResult); } @@ -807,9 +833,16 @@ public void ClearIndex() m_biliLiteDbContext.DownloadedItems.RemoveRange(m_biliLiteDbContext.DownloadedItems); } - #endregion + public void SetDownloadedSortMode(DownloadedSortMode mode) + { + m_downloadPageViewModel.DownloadedSortMode = mode; + m_downloadPageViewModel.DownloadedViewModels.Clear(); + var query = QueryDownloaded(); + m_downloadPageViewModel.DownloadedViewModels.AddRange(query); + } + #endregion } -} +} \ No newline at end of file diff --git a/src/BiliLite.UWP/ViewModels/Download/DownloadPageViewModel.cs b/src/BiliLite.UWP/ViewModels/Download/DownloadPageViewModel.cs index 8888bf25..bd712b72 100644 --- a/src/BiliLite.UWP/ViewModels/Download/DownloadPageViewModel.cs +++ b/src/BiliLite.UWP/ViewModels/Download/DownloadPageViewModel.cs @@ -9,6 +9,7 @@ using System.Threading; using Windows.Networking.BackgroundTransfer; using AutoMapper; +using BiliLite.Models.Common; namespace BiliLite.ViewModels.Download { @@ -60,6 +61,8 @@ public DownloadPageViewModel(IMapper mapper) [DoNotNotify] public List Downloadeds { get; set; } + public bool IsSearching { get; set; } + public bool LoadingDownloaded { get; set; } = true; public double DiskTotal { get; set; } @@ -75,6 +78,12 @@ public DownloadPageViewModel(IMapper mapper) [DependsOn(nameof(TotalDownloadedCount), nameof(LoadedDownloadedCount))] public int LoadingDownloadedPercent => (int)((LoadedDownloadedCount * 1f / TotalDownloadedCount * 1f) * 100); + [DoNotNotify] + public DownloadedSortMode DownloadedSortMode { get; set; } + + [DoNotNotify] + public string SearchKeyword { get; set; } + #endregion } } From 7a20b61d737bbabd2a230de7f0097669c6eacd62 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Sat, 14 Dec 2024 18:17:50 +0800 Subject: [PATCH 4/4] =?UTF-8?q?#938=20=E7=9B=B4=E6=92=AD=E5=B0=86=E4=BA=92?= =?UTF-8?q?=E5=8A=A8=E5=8C=BA=E8=87=AA=E5=8A=A8=E6=B8=85=E7=90=86=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E6=97=B6=E6=9C=BA=E6=B7=BB=E5=8A=A0=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=AC=A2=E8=BF=8E=E6=B6=88=E6=81=AF=E6=97=B6=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/Common/Live/LiveMessageHandleActionsMap.cs | 3 ++- src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/BiliLite.UWP/Models/Common/Live/LiveMessageHandleActionsMap.cs b/src/BiliLite.UWP/Models/Common/Live/LiveMessageHandleActionsMap.cs index e5ae4779..35c85b28 100644 --- a/src/BiliLite.UWP/Models/Common/Live/LiveMessageHandleActionsMap.cs +++ b/src/BiliLite.UWP/Models/Common/Live/LiveMessageHandleActionsMap.cs @@ -91,7 +91,7 @@ private void Danmu(LiveRoomViewModel viewModel, object message) } } - if (viewModel.Messages.Count >= viewModel.CleanCount) viewModel.Messages.RemoveAt(0); + viewModel.CheckClearMessages(); viewModel.Messages.Add(m); AddNewDanmu?.Invoke(null, m); } @@ -137,6 +137,7 @@ private void InteractWord(LiveRoomViewModel viewModel, object message) msg.ShowMedal = info.ShowMedal; } + viewModel.CheckClearMessages(); viewModel.Messages.Add(msg); } diff --git a/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs b/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs index eefb556e..4817e60d 100644 --- a/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs +++ b/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs @@ -1314,6 +1314,11 @@ public async Task JoinRedPocketLottery() } + public void CheckClearMessages() + { + if (Messages.Count >= CleanCount) Messages.RemoveAt(0); + } + public void Dispose() { foreach (var item in LotteryDanmu)