fix: 修复 WpfGui 自动更新时 x64 也下载 arm64 的 ota 的问题 (#3921)

fix #3920
This commit is contained in:
MistEO
2023-03-09 13:25:30 +08:00
committed by GitHub
3 changed files with 20 additions and 5 deletions

View File

@@ -34,8 +34,6 @@ jobs:
include:
- msbuild_target: x64
lowercase_target: x64
- msbuild_target: ARM64
lowercase_target: arm64
fail-fast: false
env:
MAABUILDER_TARGET_PLATFORM: ${{ matrix.msbuild_target }}
@@ -127,7 +125,7 @@ jobs:
needs: [build-win-nightly, push-tag]
strategy:
matrix:
target: [x64, arm64]
target: [x64]
runs-on: ubuntu-latest
steps:
- run: echo ${{ needs.build-win-nightly.outputs.tag }}

View File

@@ -19,7 +19,7 @@ jobs:
make-ota:
runs-on: "ubuntu-latest"
matrix:
target: [x64, arm64]
target: [x64]
steps:
- name: "Fetch MaaRelease"
uses: actions/checkout@v3

View File

@@ -155,6 +155,16 @@ namespace MaaWpfGui
}
}
/// <summary>
/// Gets the OS architecture.
/// </summary>
public static string OSArchitecture => RuntimeInformation.OSArchitecture.ToString().ToLower();
/// <summary>
/// Gets a value indicating whether the OS is arm.
/// </summary>
public static bool IsArm => OSArchitecture.StartsWith("arm");
private const string RequestUrl = "repos/MaaAssistantArknights/MaaRelease/releases";
private const string StableRequestUrl = "repos/MaaAssistantArknights/MaaAssistantArknights/releases/latest";
private const string MaaReleaseRequestUrlByTag = "repos/MaaAssistantArknights/MaaRelease/releases/tags/";
@@ -641,7 +651,14 @@ namespace MaaWpfGui
if (name.Contains("ota") && name.Contains("win") && name.Contains($"{_curVersion}_{_latestVersion}"))
{
_assetsObject = curAssets as JObject;
break;
if (IsArm ^ name.Contains("arm"))
{
continue; // 兼容旧版本,以前 ota 不区分指令集架构
}
else
{
break;
}
}
}