@@ -37,26 +37,48 @@ RAW_CHANGES=$(gorelease -base "$BASE_VERSION")
37
37
echo " Changes detected from BASE_VERSION $BASE_VERSION :"
38
38
echo " $RAW_CHANGES "
39
39
40
- BREAKING_CHANGES=$( echo " $RAW_CHANGES " | awk '
41
- /## incompatible changes/ {print "### incompatible changes"; collecting=1; next}
42
- collecting && /^#/ {collecting=0}
43
- collecting && NF {print "- "$0}
44
- ' )
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 "
45
63
46
64
set -e
47
65
popd || exit
48
66
49
- if [ -z " $BREAKING_CHANGES " ]; then
50
- echo " No major breaking changes detected"
67
+ if [ -z " $BREAKING_CHANGES " ] && [ -z " $NON_BREAKING_CHANGES " ] ; then
68
+ echo " No changes detected"
51
69
else
52
- echo " Detected major breaking changes in the release"
70
+ echo " Detected changes in the release"
53
71
if [ -z " $TARGET_BREAKING_CHANGES_FILE " ]; then
54
- echo " Breaking changes for the major release"
55
- echo " $BREAKING_CHANGES "
72
+ echo " Changes for the release:"
73
+ [ -n " $BREAKING_CHANGES " ] && echo -e " \nBreaking Changes:\n$BREAKING_CHANGES "
74
+ [ -n " $NON_BREAKING_CHANGES " ] && echo -e " \nNon-Breaking Changes:$NON_BREAKING_CHANGES "
56
75
else
57
- echo " Creating the breaking changes file with following breaking changes:"
58
- echo " $BREAKING_CHANGES "
59
- echo -e " # Breaking Changes\n## SDK changes\n$BREAKING_CHANGES \n## API Changelog\n https://www.mongodb.com/docs/atlas/reference/api-resources-spec/changelog" \
60
- > " $script_path /../breaking_changes/${TARGET_BREAKING_CHANGES_FILE} .md"
76
+ # Only create breaking changes file for major version bumps
77
+ if [ -n " $BREAKING_CHANGES " ]; then
78
+ echo " Creating the breaking changes file with following breaking changes:"
79
+ echo " $BREAKING_CHANGES "
80
+ echo -e " # Breaking Changes\n## SDK changes\n$BREAKING_CHANGES \n## API Changelog\n https://www.mongodb.com/docs/atlas/reference/api-resources-spec/changelog" \
81
+ > " $script_path /../breaking_changes/${TARGET_BREAKING_CHANGES_FILE} .md"
82
+ fi
61
83
fi
62
84
fi
0 commit comments