From 0242f14aaabb77e273f87f74cfbcad18cc562761 Mon Sep 17 00:00:00 2001 From: Yuhang Wu Date: Mon, 24 Aug 2026 17:42:02 +0800 Subject: [PATCH] =?UTF-8?q?docs(ci):=20=E4=BC=98=E5=8C=96=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=B5=81=E7=A8=8B=EF=BC=8C=E8=87=AA=E5=8A=A8=E6=8F=90?= =?UTF-8?q?=E5=8F=96=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=BD=9C=E4=B8=BArelease=20body?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改了release.yml工作流,新增步骤从CHANGELOG.md提取当前tag对应版本的更新内容,替代固定的release提示文本,同时给两个版本条目添加了新版本发布提示 --- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++-- docs/CHANGELOG.md | 2 ++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 399e374..403b968 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,42 @@ jobs: - name: Install frontend dependencies run: pnpm install --frozen-lockfile - # 7. 构建并发布(核心步骤) + # 7. 从 docs/CHANGELOG.md 提取当前 tag 对应版本的更新日志 + - name: Extract changelog for release + id: changelog + shell: bash + env: + RELEASE_TAG: ${{ github.ref_name }} + run: | + node -e ' + const fs = require("fs"); + const content = fs.readFileSync("docs/CHANGELOG.md", "utf8"); + const lines = content.split(/\r?\n/); + const marker = "## " + process.env.RELEASE_TAG; + const startIdx = lines.findIndex((l) => l.trim().startsWith(marker)); + if (startIdx === -1) { + fs.writeFileSync("release_body.md", ""); + process.exit(0); + } + let endIdx = lines.length; + for (let i = startIdx + 1; i < lines.length; i++) { + if (/^##\s/.test(lines[i])) { + endIdx = i; + break; + } + } + fs.writeFileSync( + "release_body.md", + lines.slice(startIdx + 1, endIdx).join("\n").trim() + ); + ' + { + echo "body<> "$GITHUB_OUTPUT" + + # 8. 构建并发布(核心步骤) - name: Build app & publish release uses: tauri-apps/tauri-action@v0 env: @@ -71,7 +106,7 @@ jobs: with: tagName: v__VERSION__ # 自动替换为 tauri.conf.json 里的版本号 releaseName: "StealthReader v__VERSION__" - releaseBody: "See the assets to download and install." + releaseBody: ${{ steps.changelog.outputs.body }} releaseDraft: true # 先创建草稿,手动确认后再发布 prerelease: false args: ${{ matrix.args }} diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index aafbbbc..928e81e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,6 +5,7 @@ --- ## v0.3.0(2026-08-24 16:52) +### 🎉 新版本发布! ### ✨ 新增功能 @@ -28,6 +29,7 @@ --- ## v0.2.0(2026-08-24 14:00) +### 🎉 新版本发布! ### ✨ 新增功能