@@ -28,10 +28,6 @@ if [ -z "$flow" ] && [ -f .git/RELEASE ]; then
2828 flow=release
2929 name=$( cat .git/RELEASE)
3030 zz_log i " Release branch found: {Blue $name }"
31- if ! git checkout $flow /$named ; then
32- zz_log e " Cannot switch to $flow /$name branch"
33- exit 1
34- fi
3531fi
3632
3733# Exit if no flow branch is found
@@ -40,15 +36,27 @@ if [ -z "$flow" ] || [ -z "$name" ]; then
4036 exit 1
4137fi
4238
39+ # Extract branch name
40+ if ! git checkout $flow /$name ; then
41+ zz_log e " Cannot switch to $flow /$name branch"
42+ exit 1
43+ fi
44+ zz_log s " On branch: {Blue $flow /$name }"
45+
46+ # Get the new version from gitversion
47+ GBV=$( gitversion -config .gitversion -showvariable MajorMinorPatch)
48+ if [ -z " $GBV " ]; then
49+ zz_log e " Cannot get version from .gitversion"
50+ exit 1
51+ fi
52+ zz_log i " Bump version: {Blue $GBV }"
53+
4354# Prevent git editor prompt during finish
4455GIT_EDITOR=:
4556
4657# Update version, changelog, and finish release
47- # if npx --yes commit-and-tag-version --commit-all --skip.tag --no-verify; then
48- GBV=$( bump-changelog -b -m)
49- if [ " $? " -eq 0 ] && [ -n " $GBV " ]; then
50- zz_log s " Version & CHANGELOG updated to: {B $GBV }"
51-
58+ if bump-changelog -f $GBV -b -m; then
59+ zz_log s " Version & CHANGELOG updated to: {B $GBV }"
5260 if ! git commit -am " chore(release): $GBV " ; then
5361 zz_log e " Cannot commit version & CHANGELOG"
5462 exit 1
@@ -57,10 +65,11 @@ if [ "$?" -eq 0 ] && [ -n "$GBV" ]; then
5765 zz_log s " Version & CHANGELOG committed and pushed"
5866 fi
5967
60- if git flow $flow finish $name --push --message " git flow release " --showcommands ; then
68+ if git flow $flow finish $name --push --tagname $GBV --message $GBV ; then
6169 zz_log s " Release finished: {B $GBV }"
6270 rm -f .git/RELEASE
6371 else
72+ git undo
6473 zz_log e " Cannot finish release. CHANGELOG & VERSION are not updated."
6574 fi
6675else
0 commit comments