Skip to content

Commit 7cebcca

Browse files
committed
adjust
1 parent dd2b9c3 commit 7cebcca

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,16 @@ jobs:
2929
- name: Get Semantic Release Version
3030
id: get-version
3131
run: |
32-
VERSION=$(npx semantic-release --dry-run 2>&1 | grep -o 'Release note for version [0-9]\+\.[0-9]\+\.[0-9]\+' | head -1 | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
32+
# Check if latest commit is a merge commit
33+
if git log --format="%s" -1 | grep -q "^Merge pull request"; then
34+
echo "✅ Merge commit detected, forcing patch release"
35+
# Get last tag and increment patch
36+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0")
37+
VERSION=$(echo $LAST_TAG | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
38+
else
39+
VERSION=$(npx semantic-release --dry-run 2>&1 | grep -o 'Release note for version [0-9]\+\.[0-9]\+\.[0-9]\+' | head -1 | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
40+
fi
41+
3342
if [ -z "$VERSION" ]; then
3443
echo "❌ No version could be detected by semantic-release"
3544
echo "This usually means no commits warrant a release (no feat/fix/breaking changes)"

.releaserc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
[
55
"@semantic-release/commit-analyzer",
66
{
7-
"preset": "angular",
7+
"preset": "conventionalcommits",
88
"releaseRules": [
99
{"breaking": true, "release": "minor"},
1010
{"tag": "Breaking", "release": "minor"},
11-
{"message": "/^Merge pull request/", "release": "patch"}
11+
{"type": "*", "release": "patch"}
1212
]
1313
}
1414
],

0 commit comments

Comments
 (0)