Skip to content

Commit 3abc8fe

Browse files
committed
feat: Add semantic versioning support for breaking changes
1 parent d2a89b4 commit 3abc8fe

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/update-changelog.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,31 @@ jobs:
5353
DATE=$(date +%Y-%m-%d)
5454
echo "Generating changelog entry for date: $DATE"
5555
56-
# Increment patch version
56+
# Increment version based on PR title
5757
IFS='.' read -r major minor patch <<< "$CURRENT_VERSION"
58-
NEW_VERSION="${major}.${minor}.$((patch + 1))"
58+
PR_TITLE="${{ steps.pr-info.outputs.title }}"
59+
echo "Processing PR title: $PR_TITLE"
60+
61+
if [[ "$PR_TITLE" == *"!"* || "$PR_TITLE" == *"BREAKING CHANGE"* ]]; then
62+
echo "Detected breaking change, incrementing major version"
63+
NEW_VERSION="$((major + 1)).0.0"
64+
elif [[ "$PR_TITLE" == *"feat:"* || "$PR_TITLE" == *"feature:"* ]]; then
65+
echo "Detected new feature, incrementing minor version"
66+
NEW_VERSION="${major}.$((minor + 1)).0"
67+
else
68+
echo "Detected patch change, incrementing patch version"
69+
NEW_VERSION="${major}.${minor}.$((patch + 1))"
70+
fi
71+
5972
echo "New version will be: $NEW_VERSION"
6073
6174
# Create new changelog entry
6275
NEW_ENTRY="## [v${NEW_VERSION}] - ${DATE}\n\n"
6376
6477
# Determine change type from PR title
65-
PR_TITLE="${{ steps.pr-info.outputs.title }}"
66-
echo "Processing PR title: $PR_TITLE"
67-
68-
if [[ "$PR_TITLE" == *"feat:"* || "$PR_TITLE" == *"feature:"* ]]; then
78+
if [[ "$PR_TITLE" == *"!"* || "$PR_TITLE" == *"BREAKING CHANGE"* ]]; then
79+
CHANGE_TYPE="Breaking Change"
80+
elif [[ "$PR_TITLE" == *"feat:"* || "$PR_TITLE" == *"feature:"* ]]; then
6981
CHANGE_TYPE="Added"
7082
elif [[ "$PR_TITLE" == *"fix:"* ]]; then
7183
CHANGE_TYPE="Fixed"

0 commit comments

Comments
 (0)