Skip to content
This repository was archived by the owner on Feb 12, 2026. It is now read-only.

Commit 52a8df0

Browse files
committed
feat: improve release notes generation with conventional commits support
- Add new release notes workflow using conventional-changelog - Update release-drafter config with conventional commit patterns - Remove redundant release-drafter job from release workflow - Add proper categorization for feat, fix, docs, chore, and breaking changes
1 parent c326cab commit 52a8df0

4 files changed

Lines changed: 159 additions & 35 deletions

File tree

.github/release-drafter.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name-template: 'v$RESOLVED_VERSION'
22
tag-template: 'v$RESOLVED_VERSION'
33

4+
include-pre-releases: true
5+
commitish: master
6+
47
categories:
58
- title: '🚀 Features'
69
labels:
@@ -23,7 +26,8 @@ categories:
2326
labels:
2427
- 'breaking-change'
2528

26-
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
29+
change-template: '- $TITLE (#$NUMBER)'
30+
no-changes-template: '- No changes yet'
2731
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
2832

2933
version-resolver:
@@ -63,22 +67,24 @@ exclude-labels:
6367
- 'wontfix'
6468

6569
autolabeler:
70+
- label: 'feature'
71+
title:
72+
- '/^feat(\(.+\))?\!?:.+$/i'
73+
- label: 'bug'
74+
title:
75+
- '/^fix(\(.+\))?\!?:.+$/i'
6676
- label: 'documentation'
77+
title:
78+
- '/^docs(\(.+\))?\!?:.+$/i'
6779
files:
6880
- '*.md'
6981
- 'docs/**'
70-
- label: 'bug'
71-
branch:
72-
- '/fix\/.+/'
73-
title:
74-
- '/fix/i'
75-
- label: 'feature'
76-
branch:
77-
- '/feature\/.+/'
78-
title:
79-
- '/feat/i'
8082
- label: 'chore'
81-
branch:
82-
- '/chore\/.+/'
8383
title:
84-
- '/chore/i'
84+
- '/^chore(\(.+\))?\!?:.+$/i'
85+
- '/^ci(\(.+\))?\!?:.+$/i'
86+
- '/^build(\(.+\))?\!?:.+$/i'
87+
- '/^refactor(\(.+\))?\!?:.+$/i'
88+
- label: 'breaking-change'
89+
title:
90+
- '/^.+\!:.+$/i'

.github/release-notes-config.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "## 🚀 Features",
5+
"labels": [],
6+
"rules": [
7+
{
8+
"pattern": "^feat(\\(.+\\))?!?:.+$",
9+
"flags": "gu"
10+
}
11+
]
12+
},
13+
{
14+
"title": "## 🐛 Bug Fixes",
15+
"labels": [],
16+
"rules": [
17+
{
18+
"pattern": "^fix(\\(.+\\))?!?:.+$",
19+
"flags": "gu"
20+
}
21+
]
22+
},
23+
{
24+
"title": "## 📚 Documentation",
25+
"labels": [],
26+
"rules": [
27+
{
28+
"pattern": "^docs(\\(.+\\))?!?:.+$",
29+
"flags": "gu"
30+
}
31+
]
32+
},
33+
{
34+
"title": "## 🧹 Maintenance",
35+
"labels": [],
36+
"rules": [
37+
{
38+
"pattern": "^(chore|ci|build|refactor)(\\(.+\\))?!?:.+$",
39+
"flags": "gu"
40+
}
41+
]
42+
},
43+
{
44+
"title": "## ⚠️ Breaking Changes",
45+
"labels": [],
46+
"rules": [
47+
{
48+
"pattern": "^.+!:.+$",
49+
"flags": "gu"
50+
}
51+
]
52+
}
53+
],
54+
"template": "${{CHANGELOG}}\n\n## Contributors\n\nThanks to all contributors who made this release possible!\n\n${{CONTRIBUTORS}}",
55+
"pr_template": "- ${{TITLE}} ${{MERGE_SHA}}",
56+
"empty_template": "- No changes",
57+
"transformers": [
58+
{
59+
"pattern": "^(feat|fix|docs|chore|ci|build|refactor)(\\(.+\\))?!?:\\s*(.+)$",
60+
"target": "- $3"
61+
}
62+
],
63+
"max_tags_to_fetch": 200,
64+
"max_pull_requests": 1000,
65+
"max_back_track_time_days": 365,
66+
"exclude_merge_branches": [
67+
"dependabot/**"
68+
]
69+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Generate Release Notes
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release-notes:
10+
name: Generate Release Notes
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '18'
25+
26+
- name: Install conventional-changelog-cli
27+
run: npm install -g conventional-changelog-cli
28+
29+
- name: Generate changelog
30+
run: |
31+
# Get the last tag
32+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
33+
34+
if [ -z "$LAST_TAG" ]; then
35+
# If no tags exist, generate changelog from all commits
36+
conventional-changelog -p angular -r 0 -o RELEASE_NOTES.md
37+
else
38+
# Generate changelog from last tag to HEAD
39+
conventional-changelog -p angular -o RELEASE_NOTES.md
40+
fi
41+
42+
- name: Get next version
43+
id: version
44+
run: |
45+
# Get current version from package.json
46+
CURRENT_VERSION=$(node -p "require('./package.json').version")
47+
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
48+
49+
# Simple versioning: increment patch version
50+
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
51+
MAJOR=${VERSION_PARTS[0]}
52+
MINOR=${VERSION_PARTS[1]}
53+
PATCH=${VERSION_PARTS[2]}
54+
NEW_PATCH=$((PATCH + 1))
55+
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
56+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
57+
58+
- name: Create or update release draft
59+
if: success()
60+
run: |
61+
RELEASE_NOTES=$(cat RELEASE_NOTES.md)
62+
63+
# Create release draft
64+
gh release create "v${{ steps.version.outputs.new_version }}" \
65+
--title "Release v${{ steps.version.outputs.new_version }}" \
66+
--notes "$RELEASE_NOTES" \
67+
--draft \
68+
--latest
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,6 @@ jobs:
3333
echo "No build script found in package.json, skipping build step."
3434
fi
3535
36-
draft_release_notes:
37-
name: Draft Release Notes
38-
# This job runs only on pushes to the master branch
39-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
40-
runs-on: ubuntu-latest
41-
permissions:
42-
contents: write # Required to create/update GitHub release drafts
43-
pull-requests: write # Required if release-drafter interacts with PRs (e.g., labeling)
44-
steps:
45-
- name: Checkout code (full depth)
46-
uses: actions/checkout@v4
47-
with:
48-
fetch-depth: 0 # Fetches all history for release-drafter to analyze commits
49-
50-
- name: Draft next release notes
51-
uses: release-drafter/release-drafter@v6
52-
with:
53-
publish: false # Set to false to only create/update a draft. True would auto-publish (not typical for this job).
54-
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub Actions
56-
5736
publish_to_npm:
5837
name: Publish to npm
5938
if: github.event_name == 'release' && github.event.action == 'published'

0 commit comments

Comments
 (0)