From c5b8b18e33b65ad5acd44fbe236c444b36b6d3d5 Mon Sep 17 00:00:00 2001 From: YHH <359807859@qq.com> Date: Sat, 18 Oct 2025 21:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=87=AA=E4=B8=8A=E4=B8=AA?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=91=E5=B8=83=E4=BE=9D=E8=B5=96=E7=9A=84?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=E5=86=8Dpr=E9=87=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-core.yml | 124 ++++++++++++++++++++--------- 1 file changed, 85 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release-core.yml b/.github/workflows/release-core.yml index 2a22b0d5..9105a07e 100644 --- a/.github/workflows/release-core.yml +++ b/.github/workflows/release-core.yml @@ -116,6 +116,33 @@ jobs: - name: Install dependencies run: npm ci + - name: Generate changelog + id: changelog + run: | + # 获取上一个core版本的tag + PREVIOUS_TAG=$(git tag -l "core-v*" --sort=-v:refname | head -n 1) + + if [ -z "$PREVIOUS_TAG" ]; then + echo "No previous tag found, using initial commit" + PREVIOUS_TAG=$(git rev-list --max-parents=0 HEAD) + fi + + echo "Generating changelog from $PREVIOUS_TAG to HEAD" + + # 生成变更日志(只包含core相关的提交) + CHANGELOG=$(git log $PREVIOUS_TAG..HEAD --pretty=format:"- %s (%h)" --no-merges -- packages/core/) + + if [ -z "$CHANGELOG" ]; then + CHANGELOG="No changes to core package since last release" + fi + + # 保存到文件以便在PR中使用 + echo "$CHANGELOG" > /tmp/changelog.txt + + # 输出用于调试 + echo "Changelog:" + cat /tmp/changelog.txt + - name: Update version in package.json run: | cd packages/core @@ -136,6 +163,63 @@ jobs: echo "Updated package.json to version: $NEW_VERSION" cat package.json | grep version + - name: Prepare PR body + id: pr_body + run: | + CHANGELOG_CONTENT=$(cat /tmp/changelog.txt) + + # 创建PR描述 + cat > /tmp/pr_body.md <