Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 103f776

Browse files
vansangpfievhiento09
authored andcommitted
fix: updater universal
1 parent 5ee7c9d commit 103f776

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

.github/workflows/nightly-build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ jobs:
9696
run: |
9797
echo "{\"tag_name\": \"v${{ needs.get-update-version.outputs.new_version }}\"}" > version.json
9898
aws s3 cp version.json s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/version.json
99-
aws s3 cp s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/mac-amd64-cortex-nightly.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/mac-amd64/cortex-nightly.tar.gz
100-
aws s3 cp s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/mac-arm64-cortex-nightly.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/mac-arm64/cortex-nightly.tar.gz
99+
aws s3 cp s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/mac-universal-cortex-nightly.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/mac-amd64/cortex-nightly.tar.gz
100+
aws s3 cp s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/mac-universal-cortex-nightly.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/mac-arm64/cortex-nightly.tar.gz
101+
aws s3 cp s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/mac-universal-cortex-nightly.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/mac-universal/cortex-nightly.tar.gz
101102
aws s3 cp s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/linux-amd64-cortex-nightly.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/linux-amd64/cortex-nightly.tar.gz
102103
aws s3 cp s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/windows-amd64-cortex-nightly.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/windows-amd64/cortex-nightly.tar.gz
103104

engine/commands/cortex_upd_cmd.cc

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ std::chrono::seconds GetTimeSinceEpochMillisec() {
2727
using namespace std::chrono;
2828
return duration_cast<seconds>(system_clock::now().time_since_epoch());
2929
}
30+
31+
std::unique_ptr<system_info_utils::SystemInfo> GetSystemInfoWithUniversal() {
32+
auto system_info = system_info_utils::GetSystemInfo();
33+
if (system_info->os == "mac") {
34+
CTL_INF("Change arch from " << system_info->arch << " to universal");
35+
system_info->arch = "universal";
36+
}
37+
return system_info;
38+
}
39+
3040
} // namespace
3141

3242
std::optional<std::string> CheckNewUpdate(
@@ -222,7 +232,7 @@ void CortexUpdCmd::Exec(const std::string& v) {
222232
}
223233

224234
bool CortexUpdCmd::GetStable(const std::string& v) {
225-
auto system_info = system_info_utils::GetSystemInfo();
235+
auto system_info = GetSystemInfoWithUniversal();
226236
CTL_INF("OS: " << system_info->os << ", Arch: " << system_info->arch);
227237

228238
// Download file
@@ -276,7 +286,7 @@ bool CortexUpdCmd::GetStable(const std::string& v) {
276286
}
277287

278288
bool CortexUpdCmd::GetBeta(const std::string& v) {
279-
auto system_info = system_info_utils::GetSystemInfo();
289+
auto system_info = GetSystemInfoWithUniversal();
280290
CTL_INF("OS: " << system_info->os << ", Arch: " << system_info->arch);
281291

282292
// Download file
@@ -407,11 +417,11 @@ bool CortexUpdCmd::HandleGithubRelease(const nlohmann::json& assets,
407417
}
408418

409419
bool CortexUpdCmd::GetNightly(const std::string& v) {
410-
auto system_info = system_info_utils::GetSystemInfo();
420+
auto system_info = GetSystemInfoWithUniversal();
411421
CTL_INF("OS: " << system_info->os << ", Arch: " << system_info->arch);
412422

413423
// Download file
414-
std::string version = v.empty() ? "latest" : std::move(v);
424+
std::string version = v.empty() ? "latest" : v;
415425
std::string os_arch{system_info->os + "-" + system_info->arch};
416426
const char* paths[] = {
417427
"cortex",
@@ -447,7 +457,7 @@ bool CortexUpdCmd::GetNightly(const std::string& v) {
447457
.localPath = localPath,
448458
}}};
449459

450-
DownloadService().AddDownloadTask(
460+
auto res = DownloadService().AddDownloadTask(
451461
download_task, [](const DownloadTask& finishedTask) {
452462
// try to unzip the downloaded file
453463
CTL_INF("Downloaded engine path: "
@@ -462,6 +472,11 @@ bool CortexUpdCmd::GetNightly(const std::string& v) {
462472
CTL_INF("Finished!");
463473
});
464474

475+
if (res.has_error()) {
476+
CLI_LOG("Download failed!");
477+
return false;
478+
}
479+
465480
// Replace binary file
466481
auto executable_path = file_manager_utils::GetExecutableFolderContainerPath();
467482
auto src =

0 commit comments

Comments
 (0)