File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -81,33 +81,30 @@ jobs:
8181 git fetch
8282 last_tag=${{ steps.previous_tag.outputs.previous_tag }}
8383 commit_range="${last_tag}..HEAD"
84- major=0
85- minor=0
86- patch=0
84+ major=$(echo "$last_tag" | cut -d. -f1)
85+ minor=$(echo "$last_tag" | cut -d. -f2)
86+ patch=$(echo "$last_tag" | cut -d. -f3)
8787 while IFS= read -r line; do
8888 subject=$(echo "$line" | cut -d' ' -f2-) # Extract the commit subject
8989 case "$subject" in
9090 *'feat:'*)
9191 minor=$((minor + 1))
92+ patch=0
9293 ;;
9394 *'fix:'*)
9495 patch=$((patch + 1))
9596 ;;
9697 *'BREAKING CHANGE:'*)
9798 major=$((major + 1))
99+ minor=0
100+ patch=0
98101 ;;
99102 *)
100103 patch=$((patch + 1))
101104 ;;
102105 esac
103106 done < <(git log --pretty=format:"%h %s" "$commit_range")
104- if [ $major -gt 0 ]; then
105- new_version="$((major + 1)).0.0"
106- elif [ $minor -gt 0 ]; then
107- new_version="$major.$((minor + 1)).0"
108- else
109- new_version="$major.$minor.$((patch + 1))"
110- fi
107+ new_version="$major.$minor.$patch"
111108 echo "NEW VERSION SHOULD BE => $new_version"
112109 echo "::set-output name=new_version::$new_version"
113110
You can’t perform that action at this time.
0 commit comments