From 2c16dcf96b6a5a2563bb4c35e4586aa91f88a58b Mon Sep 17 00:00:00 2001 From: GOXF <131693427+GOXF@users.noreply.github.com> Date: Sun, 8 Nov 2026 04:02:29 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E2=80=94=E2=80=94=E5=9C=A8=E7=BA=BF=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=94=B9=E7=94=A8=20Launcher=20=E6=89=93=E5=BC=80?= =?UTF-8?q?=E3=80=81=E6=98=BE=E7=A4=BA=E5=8F=91=E5=B8=83=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E3=80=81=E5=8F=91=E5=B8=83=E8=AF=B4=E6=98=8E=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E5=B9=B6=E5=88=97=E5=87=BA=E8=87=AA=E6=9C=89?= =?UTF-8?q?=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-custom.yml | 34 +++++++++++++++----- src/DeskBox/Services/AppUpdateService.cs | 7 ++++ src/DeskBox/Views/ReleaseNotesWindow.xaml.cs | 23 ++++++++++++- 3 files changed, 55 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release-custom.yml b/.github/workflows/release-custom.yml index 2324c7e8e..1357b9b64 100644 --- a/.github/workflows/release-custom.yml +++ b/.github/workflows/release-custom.yml @@ -45,6 +45,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Resolve fork version id: ver @@ -189,22 +191,38 @@ jobs: $tag = '${{ steps.ver.outputs.tag }}' $version = '${{ steps.ver.outputs.version }}' $files = @(Get-ChildItem -LiteralPath .artifacts\release -File | ForEach-Object FullName) - $notes = @" - DeskBox fork build $version (GOXF/DeskBox, branch ${{ github.ref_name }}, commit ${{ github.sha }}). - - Upstream base version ${{ steps.ver.outputs.base }} + fork revision ${{ steps.ver.outputs.rev }}. - Unsigned x64 Direct Full Native AOT installer; SHA-256 in the .sha256 file. - "@ + git fetch --tags --force origin main 2>$null + $prev = git tag --list 'v*.*.*.*' --sort=-v:refname | Where-Object { $_ -ne $tag } | Select-Object -First 1 + $range = @('HEAD', '--not', 'origin/main') + if ($prev) { $range += $prev } + $changes = @(git log --no-merges --pretty='- %s (%h)' @range -- . ':!.github') + if ($changes.Count -eq 0) { $changes = @('- 无自有改动(仅同步上游)') } + $since = if ($prev) { "自 $prev 以来" } else { '相对上游' } + $notes = @( + "## DeskBox $version(GOXF 自有版本)", + '', + "基于上游 DeskBox v${{ steps.ver.outputs.base }},自有修订 ${{ steps.ver.outputs.rev }}。", + '', + "### ${since}的自有改动", + $changes, + '', + '### 上游更新', + "上游 v${{ steps.ver.outputs.base }} 的完整更新内容见 https://github.com/Tianyu199509/DeskBox/releases/tag/v${{ steps.ver.outputs.base }}", + '', + "x64 安装包,未签名;SHA-256 见 .sha256 文件。提交 ${{ github.sha }}。" + ) -join "`n" + $notesFile = Join-Path $env:RUNNER_TEMP 'release-notes.md' + Set-Content -LiteralPath $notesFile -Value $notes -Encoding utf8NoBOM gh release view $tag --repo $env:GITHUB_REPOSITORY *> $null if ($LASTEXITCODE -eq 0) { Write-Host "Release $tag exists; replacing assets." gh release upload $tag @files --clobber --repo $env:GITHUB_REPOSITORY if ($LASTEXITCODE -ne 0) { throw 'gh release upload failed.' } - gh release edit $tag --latest --draft=false --prerelease=false --repo $env:GITHUB_REPOSITORY + gh release edit $tag --latest --draft=false --prerelease=false --notes-file $notesFile --repo $env:GITHUB_REPOSITORY if ($LASTEXITCODE -ne 0) { throw 'gh release edit failed.' } } else { - gh release create $tag @files --target $env:GITHUB_SHA --title "DeskBox $version" --notes $notes --latest --repo $env:GITHUB_REPOSITORY + gh release create $tag @files --target $env:GITHUB_SHA --title "DeskBox $version" --notes-file $notesFile --latest --repo $env:GITHUB_REPOSITORY if ($LASTEXITCODE -ne 0) { throw 'gh release create failed.' } } gh release view $tag --repo $env:GITHUB_REPOSITORY --json url,tagName,isDraft,isPrerelease,assets diff --git a/src/DeskBox/Services/AppUpdateService.cs b/src/DeskBox/Services/AppUpdateService.cs index fabccee8c..7d4e22fcc 100644 --- a/src/DeskBox/Services/AppUpdateService.cs +++ b/src/DeskBox/Services/AppUpdateService.cs @@ -856,11 +856,15 @@ internal static bool TrySelectInstallerForArchitecture( MirrorUrl = DefaultManualDownloadUrl, Sha256 = sha256, Size = Math.Max(0, installerAsset.Size), + ReleaseDate = release.PublishedAt is { } publishedAt + ? publishedAt.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture) + : string.Empty, ReleaseNotesUrl = release.HtmlUrl, ReleaseNotes = string.IsNullOrWhiteSpace(release.Body) ? [] : new Dictionary(StringComparer.OrdinalIgnoreCase) { + ["zh-CN"] = release.Body, ["en-US"] = release.Body }, Summary = [] @@ -1062,6 +1066,9 @@ private sealed class GitHubReleaseResponse [JsonPropertyName("body")] public string Body { get; set; } = string.Empty; + [JsonPropertyName("published_at")] + public DateTimeOffset? PublishedAt { get; set; } + public GitHubReleaseAsset[] Assets { get; set; } = []; } diff --git a/src/DeskBox/Views/ReleaseNotesWindow.xaml.cs b/src/DeskBox/Views/ReleaseNotesWindow.xaml.cs index c837f7d5c..239a32625 100644 --- a/src/DeskBox/Views/ReleaseNotesWindow.xaml.cs +++ b/src/DeskBox/Views/ReleaseNotesWindow.xaml.cs @@ -519,10 +519,31 @@ private void OpenOnlineButton_Click(object sender, RoutedEventArgs e) if (AppUpdateManifest.IsSafeReleaseNotesUrl(manifest.ReleaseNotesUrl)) { - Win32Helper.OpenFile(manifest.ReleaseNotesUrl); + _ = OpenReleaseNotesUrlAsync(manifest.ReleaseNotesUrl); } } + // ShellExecute on an https URL fails with "no associated app" on machines + // whose default-browser association is incomplete; the WinRT launcher + // resolves the protocol handler the same way the Start menu does. + private static async Task OpenReleaseNotesUrlAsync(string url) + { + try + { + if (Uri.TryCreate(url, UriKind.Absolute, out Uri? uri) && + await Launcher.LaunchUriAsync(uri)) + { + return; + } + } + catch (Exception ex) + { + App.Log($"[ReleaseNotes] Launcher failed for '{url}': {ex.Message}"); + } + + Win32Helper.OpenFile(url); + } + private void CloseButton_Click(object sender, RoutedEventArgs e) => Close(); private void RootGrid_KeyDown(object sender, KeyRoutedEventArgs e)