File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -25,19 +25,20 @@ echo "----------------------------------------"
2525echo " $CHANGELOG_BODY "
2626echo " ----------------------------------------"
2727
28- # --- Step 2: Prompt for new version ---
29- read -p " 🔖 Enter new version (previous: $CURRENT_VERSION ): " NEW_VERSION
30-
31- if [[ -z " $NEW_VERSION " ]]; then
32- echo " ❌ Version is required. Aborting."
33- exit 1
28+ # --- Step 2: Generate new version automatically ---
29+ if echo " $CHANGELOG_BODY " | grep -q " ### 🚀 Features" ; then
30+ echo " 🚀 Features detected: bumping minor version"
31+ # Bump minor version
32+ IFS=' .' read -r MAJOR MINOR PATCH <<< " $CURRENT_VERSION"
33+ NEW_VERSION=" $MAJOR .$(( MINOR + 1 )) .0"
34+ else
35+ echo " 🐛 Patch changes: bumping patch version"
36+ # Bump patch version
37+ IFS=' .' read -r MAJOR MINOR PATCH <<< " $CURRENT_VERSION"
38+ NEW_VERSION=" $MAJOR .$MINOR .$(( PATCH + 1 )) "
3439fi
3540
36- # Validate semver-ish format (basic check)
37- if ! [[ " $NEW_VERSION " =~ ^[0-9]+\. [0-9]+\. [0-9]+ (-.* )? $ ]]; then
38- echo " ❌ Invalid version format. Must be like 1.2.3 or 1.2.3-beta.1"
39- exit 1
40- fi
41+ echo " 🔖 New version: $NEW_VERSION (previous: $CURRENT_VERSION )"
4142
4243# --- Step 3: Generate changelog file ---
4344DATE=$( date +%Y-%m-%d)
You can’t perform that action at this time.
0 commit comments