显示自上个版本发布依赖的更新内容再pr里

This commit is contained in:
YHH
2025-10-18 21:06:04 +08:00
parent 7280265a64
commit c5b8b18e33

View File

@@ -116,6 +116,33 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: npm ci 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 - name: Update version in package.json
run: | run: |
cd packages/core cd packages/core
@@ -136,30 +163,30 @@ jobs:
echo "Updated package.json to version: $NEW_VERSION" echo "Updated package.json to version: $NEW_VERSION"
cat package.json | grep version cat package.json | grep version
- name: Create Pull Request - name: Prepare PR body
id: cpr id: pr_body
uses: peter-evans/create-pull-request@v6 run: |
with: CHANGELOG_CONTENT=$(cat /tmp/changelog.txt)
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore(core): bump version to ${{ env.NEW_VERSION }}" # 创建PR描述
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com> cat > /tmp/pr_body.md <<EOF
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
branch: release/core-v${{ env.NEW_VERSION }}
delete-branch: true
title: "chore(core): Release v${{ env.NEW_VERSION }}"
body: |
## 🚀 发布 @esengine/ecs-framework v${{ env.NEW_VERSION }} / Release @esengine/ecs-framework v${{ env.NEW_VERSION }} ## 🚀 发布 @esengine/ecs-framework v${{ env.NEW_VERSION }} / Release @esengine/ecs-framework v${{ env.NEW_VERSION }}
**中文说明** **中文说明**
此 PR 在成功发布到 npm 后更新核心包的版本号。 此 PR 在成功发布到 npm 后更新核心包的版本号。
### 📝 更新日志
\`\`\`
${CHANGELOG_CONTENT}
\`\`\`
### 变更内容 ### 变更内容
- ✅ 更新 `packages/core/package.json` → `${{ env.NEW_VERSION }}` - ✅ 更新 \`packages/core/package.json\` → \`${{ env.NEW_VERSION }}\`
### 发布信息 ### 发布信息
- 📦 **版本类型**: `${{ github.event.inputs.version_type }}` - 📦 **版本类型**: \`${{ github.event.inputs.version_type }}\`
- 🏷️ **Git 标签**: `core-v${{ env.NEW_VERSION }}` - 🏷️ **Git 标签**: \`core-v${{ env.NEW_VERSION }}\`
- 📦 **npm 包**: https://www.npmjs.com/package/@esengine/ecs-framework/v/${{ env.NEW_VERSION }} - 📦 **npm 包**: https://www.npmjs.com/package/@esengine/ecs-framework/v/${{ env.NEW_VERSION }}
### 下一步 ### 下一步
@@ -172,12 +199,17 @@ jobs:
This PR updates the core package version after successful npm release. This PR updates the core package version after successful npm release.
### 📝 Changelog
\`\`\`
${CHANGELOG_CONTENT}
\`\`\`
### Changes ### Changes
- ✅ Updated `packages/core/package.json` → `${{ env.NEW_VERSION }}` - ✅ Updated \`packages/core/package.json\` → \`${{ env.NEW_VERSION }}\`
### Release Information ### Release Information
- 📦 **Version Type**: `${{ github.event.inputs.version_type }}` - 📦 **Version Type**: \`${{ github.event.inputs.version_type }}\`
- 🏷️ **Git Tag**: `core-v${{ env.NEW_VERSION }}` - 🏷️ **Git Tag**: \`core-v${{ env.NEW_VERSION }}\`
- 📦 **npm Package**: https://www.npmjs.com/package/@esengine/ecs-framework/v/${{ env.NEW_VERSION }} - 📦 **npm Package**: https://www.npmjs.com/package/@esengine/ecs-framework/v/${{ env.NEW_VERSION }}
### Next Steps ### Next Steps
@@ -186,6 +218,20 @@ jobs:
--- ---
*此 PR 由发布工作流自动创建 / This PR was automatically created by the release workflow.* *此 PR 由发布工作流自动创建 / This PR was automatically created by the release workflow.*
EOF
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore(core): bump version to ${{ env.NEW_VERSION }}"
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
branch: release/core-v${{ env.NEW_VERSION }}
delete-branch: true
title: "chore(core): Release v${{ env.NEW_VERSION }}"
body-path: /tmp/pr_body.md
labels: | labels: |
release release
core core