chore(ci): integrate git-cliff for automated changelog generation

- Add cliff.toml configuration matching current CHANGELOG.md format
- Replace awk script with npx git-cliff in release workflow
- Add `make changelog` command for one-click CHANGELOG updates
- Use git-cliff --current flag to generate release notes per version

Generated with swe-agent-bot

Co-Authored-By: swe-agent-bot <agent@swe-agent.ai>
This commit is contained in:
cexll
2025-12-16 10:47:18 +08:00
parent 6a66c9741f
commit 3d27d44676
4 changed files with 110 additions and 19 deletions

View File

@@ -97,6 +97,11 @@ jobs:
with:
path: artifacts
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Prepare release files
run: |
mkdir -p release
@@ -104,32 +109,20 @@ jobs:
cp install.sh install.bat release/
ls -la release/
- name: Extract release notes from CHANGELOG
id: extract_notes
- name: Generate release notes with git-cliff
run: |
VERSION=${GITHUB_REF#refs/tags/v}
# Install git-cliff via npx
npx git-cliff@latest --current --strip all -o release_notes.md
# Extract version section from CHANGELOG.md
awk -v ver="$VERSION" '
/^## [0-9]+\.[0-9]+\.[0-9]+ - / {
if (found) exit
if ($2 == ver) {
found = 1
next
}
}
found && /^## / { exit }
found { print }
' CHANGELOG.md > release_notes.md
# Fallback to auto-generated if extraction failed
# Fallback if generation failed
if [ ! -s release_notes.md ]; then
echo "⚠️ No release notes found in CHANGELOG.md for version $VERSION" > release_notes.md
echo "⚠️ Failed to generate release notes with git-cliff" > release_notes.md
echo "" >> release_notes.md
echo "## What's Changed" >> release_notes.md
echo "See commits in this release for details." >> release_notes.md
fi
echo "--- Generated Release Notes ---"
cat release_notes.md
- name: Create Release

View File

@@ -2,6 +2,17 @@
All notable changes to this project will be documented in this file.
## [5.2.4] - 2025-12-16
### 🐛 Bug Fixes
- *(executor)* Isolate log files per task in parallel mode
- *(codeagent)* 防止 Claude backend 无限递归调用
### ⚙️ Miscellaneous Tasks
- Bump version to 5.2.4
## [5.2.3] - 2025-12-15
### 🐛 Bug Fixes

View File

@@ -1,7 +1,7 @@
# Claude Code Multi-Agent Workflow System Makefile
# Quick deployment for BMAD and Requirements workflows
.PHONY: help install deploy-bmad deploy-requirements deploy-essentials deploy-advanced deploy-all deploy-commands deploy-agents clean test
.PHONY: help install deploy-bmad deploy-requirements deploy-essentials deploy-advanced deploy-all deploy-commands deploy-agents clean test changelog
# Default target
help:
@@ -22,6 +22,7 @@ help:
@echo " deploy-all - Deploy everything (commands + agents)"
@echo " test-bmad - Test BMAD workflow with sample"
@echo " test-requirements - Test Requirements workflow with sample"
@echo " changelog - Update CHANGELOG.md using git-cliff"
@echo " clean - Clean generated artifacts"
@echo " help - Show this help message"
@@ -145,3 +146,17 @@ all: deploy-all
version:
@echo "Claude Code Multi-Agent Workflow System v3.1"
@echo "BMAD + Requirements-Driven Development"
# Update CHANGELOG.md using git-cliff
changelog:
@echo "📝 Updating CHANGELOG.md with git-cliff..."
@if ! command -v git-cliff > /dev/null 2>&1; then \
echo "❌ git-cliff not found. Installing via Homebrew..."; \
brew install git-cliff; \
fi
@git-cliff -o CHANGELOG.md
@echo "✅ CHANGELOG.md updated successfully!"
@echo ""
@echo "Preview the changes:"
@echo " git diff CHANGELOG.md"

72
cliff.toml Normal file
View File

@@ -0,0 +1,72 @@
# git-cliff configuration file
# https://git-cliff.org/docs/configuration
[changelog]
# changelog header
header = """
# Changelog
All notable changes to this project will be documented in this file.
"""
# template for the changelog body
body = """
{% if version %}
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}
## Unreleased
{% endif %}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group }}
{% for commit in commits %}
- {{ commit.message | split(pat="\n") | first }}
{% endfor -%}
{% endfor -%}
"""
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
footer = """
<!-- generated by git-cliff -->
"""
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = false
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/cexll/myclaude/issues/${2}))" },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "🚀 Features" },
{ message = "^fix", group = "🐛 Bug Fixes" },
{ message = "^doc", group = "📚 Documentation" },
{ message = "^perf", group = "⚡ Performance" },
{ message = "^refactor", group = "🚜 Refactor" },
{ message = "^style", group = "🎨 Styling" },
{ message = "^test", group = "🧪 Testing" },
{ message = "^chore\\(release\\):", skip = true },
{ message = "^chore", group = "⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "🛡️ Security" },
{ message = "^revert", group = "◀️ Revert" },
{ message = ".*", group = "💼 Other" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "newest"