From 529886a9081f6f3db5bdd0ec26d30cd591441c6b Mon Sep 17 00:00:00 2001 From: denglihong2007 <2639367181@qq.com> Date: Sun, 2 Mar 2025 14:37:15 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20TMD=E8=BF=99=E7=8E=A9=E6=84=8F=E5=84=BF?= =?UTF-8?q?=E8=83=BD=E5=A5=BD=E5=90=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f5dcfd0..9b7c2b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -92,32 +92,20 @@ jobs: shell: pwsh run: | - # 获取最新 Release 版本号 - $latestTag = gh release list --limit 1 --json tagName --jq ".[0].tagName" 2>$null + $releaseInfo = gh release view --json tagName | ConvertFrom-Json + $latestTag = $releaseInfo.tagName echo "Latest release tag: $latestTag" - if (-not $latestTag) { - $latestTag = "" - } $originalOutputEncoding = [Console]::OutputEncoding [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 + $releaseNotesPath = "release_notes.md" try { - # 初始化日志文件(UTF-8 编码) - $releaseNotesPath = "release_notes.md" echo "Release notes path: $releaseNotesPath" - - # 获取 Commit 日志 - if (-not $latestTag) { - Set-Content -Path $releaseNotesPath -Value "## 初始版本" -Encoding UTF8 - $commitLogs = git log --pretty=format:"%s" - } else { - $latestTag += "..HEAD" - Set-Content -Path $releaseNotesPath -Value "## 更新日志" -Encoding UTF8 - $commitLogs = git log $latestTag --pretty=format:"%s" - } + $latestTag += "..HEAD" + Set-Content -Path $releaseNotesPath -Value "## 更新日志" -Encoding UTF8 + $commitLogs = git log $latestTag --pretty=format:"%s" echo "Commit logs: $commitLogs" } finally { - # 恢复原始编码设置 [Console]::OutputEncoding = $originalOutputEncoding }