Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ jobs:
steps:
- name: Extract version from commit message
id: extract
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: |
COMMIT_MSG="${{ github.event.head_commit.message }}"
# Only tag versions on main branch
if [ "${{ github.ref }}" = "refs/heads/main" ] && [[ "$COMMIT_MSG" =~ ^(v[0-9]+\.[0-9]+\.[0-9]+): ]]; then
if [ "$GITHUB_REF" = "refs/heads/main" ] && [[ "$COMMIT_MSG" =~ ^(v[0-9]+\.[0-9]+\.[0-9]+): ]]; then
VERSION="${BASH_REMATCH[1]}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "is_release=true" >> $GITHUB_OUTPUT
Expand Down
30 changes: 21 additions & 9 deletions scripts/create-single-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ async function fetchGitHubCommitDetails(

const githubUsername = commit.author?.login || commit.committer?.login || 'unknown'

let cleanMessage = commit.commit.message.split('\n')[0] // First line only
let cleanMessage = commit.commit.message.split('\n')[0]
if (prNumber) {
cleanMessage = cleanMessage.replace(/\s*\(#\d+\)\s*$/, '')
}
Expand Down Expand Up @@ -226,12 +226,23 @@ async function getCommitsBetweenVersions(
function categorizeCommit(message: string): 'features' | 'fixes' | 'improvements' | 'other' {
const msgLower = message.toLowerCase()

if (
msgLower.includes('feat') ||
msgLower.includes('add') ||
msgLower.includes('implement') ||
msgLower.includes('new ')
) {
if (/^feat(\(|:|!)/.test(msgLower)) {
return 'features'
}

if (/^fix(\(|:|!)/.test(msgLower)) {
return 'fixes'
}

if (/^(improvement|improve|perf|refactor)(\(|:|!)/.test(msgLower)) {
return 'improvements'
}

if (/^(chore|docs|style|test|ci|build)(\(|:|!)/.test(msgLower)) {
return 'other'
}

if (msgLower.includes('feat') || msgLower.includes('implement') || msgLower.includes('new ')) {
return 'features'
}

Expand All @@ -242,9 +253,10 @@ function categorizeCommit(message: string): 'features' | 'fixes' | 'improvements
if (
msgLower.includes('improve') ||
msgLower.includes('enhance') ||
msgLower.includes('update') ||
msgLower.includes('upgrade') ||
msgLower.includes('optimization')
msgLower.includes('optimization') ||
msgLower.includes('add') ||
msgLower.includes('update')
) {
return 'improvements'
}
Expand Down