Skip to content

Commit d54ab7c

Browse files
authored
fix: Fixes SDK generation for minor versions (#590)
1 parent b3fee40 commit d54ab7c

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

tools/releaser/scripts/breaking-changes.sh

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ baseVersion() {
2424
export BASE_VERSION="$base_version"
2525
}
2626

27+
# Extract changes based on pattern
28+
extractChanges() {
29+
local raw_changes=$1
30+
local pattern=$2
31+
local header=$3
32+
echo "$raw_changes" | awk -v pattern="$pattern" -v header="$header" '
33+
$0 ~ pattern {print header; collecting=1; next}
34+
collecting && /^#/ {collecting=0}
35+
collecting && NF {print "- "$0}
36+
'
37+
}
38+
2739
baseVersion
2840

2941
echo "Installing gorelease"
@@ -37,29 +49,8 @@ RAW_CHANGES=$(gorelease -base "$BASE_VERSION")
3749
echo "Changes detected from BASE_VERSION $BASE_VERSION:"
3850
echo "$RAW_CHANGES"
3951

40-
# Function to extract changes by section
41-
extract_changes() {
42-
local section=$1
43-
echo "$RAW_CHANGES" | awk -v section="$section" '
44-
$0 ~ section {print "### " section; collecting=1; next}
45-
collecting && /^#/ {collecting=0}
46-
collecting && NF {print "- "$0}
47-
'
48-
}
49-
50-
# Extract different types of changes
51-
BREAKING_CHANGES=$(extract_changes "incompatible changes")
52-
NEW_FEATURES=$(extract_changes "new features")
53-
BUG_FIXES=$(extract_changes "bug fixes")
54-
DEPRECATIONS=$(extract_changes "deprecations")
55-
OTHER_CHANGES=$(extract_changes "other changes")
56-
57-
# Combine non-breaking changes for release notes
58-
NON_BREAKING_CHANGES=""
59-
[ -n "$NEW_FEATURES" ] && NON_BREAKING_CHANGES+="\n## New Features\n$NEW_FEATURES"
60-
[ -n "$BUG_FIXES" ] && NON_BREAKING_CHANGES+="\n## Bug Fixes\n$BUG_FIXES"
61-
[ -n "$DEPRECATIONS" ] && NON_BREAKING_CHANGES+="\n## Deprecations\n$DEPRECATIONS"
62-
[ -n "$OTHER_CHANGES" ] && NON_BREAKING_CHANGES+="\n## Other Changes\n$OTHER_CHANGES"
52+
BREAKING_CHANGES=$(extractChanges "$RAW_CHANGES" "## incompatible changes" "### incompatible changes")
53+
NON_BREAKING_CHANGES=$(extractChanges "$RAW_CHANGES" "## compatible changes" "### compatible changes")
6354

6455
set -e
6556
popd || exit
@@ -71,7 +62,7 @@ else
7162
if [ -z "$TARGET_BREAKING_CHANGES_FILE" ]; then
7263
echo "Changes for the release:"
7364
[ -n "$BREAKING_CHANGES" ] && echo -e "\nBreaking Changes:\n$BREAKING_CHANGES"
74-
[ -n "$NON_BREAKING_CHANGES" ] && echo -e "\nNon-Breaking Changes:$NON_BREAKING_CHANGES"
65+
[ -n "$NON_BREAKING_CHANGES" ] && echo -e "\nNon-Breaking Changes:\n$NON_BREAKING_CHANGES"
7566
else
7667
# Only create breaking changes file for major version bumps
7768
if [ -n "$BREAKING_CHANGES" ]; then

0 commit comments

Comments
 (0)