Skip to content

Commit 9de255e

Browse files
committed
fix(gitutils): 🐛 refine version extraction
1 parent 7e8a860 commit 9de255e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/gitutils/_git-release-prod.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ cd "$(git rev-parse --show-toplevel)" >/dev/null
1212
# Check if on a hotfix branch and extract branch name
1313
if [ -n "$(git branch --list hotfix/*)" ]; then
1414
flow=hotfix
15-
name=$(git branch --list hotfix/* | sed 's/.*hotfix\///')
15+
name=$(git branch --list hotfix/* | sed 's/.*hotfix\///'| head -n1 )
1616
zz_log i "Hotfix branch found: {Yellow $name}"
1717
fi
1818

1919
# Check if on a release branch and extract branch name
2020
if [ -n "$(git branch --list release/*)" ]; then
2121
flow=release
22-
name=$(git branch --list release/* | sed 's/.*release\///')
22+
name=$(git branch --list release/* | sed 's/.*release\///' | head -n1 )
2323
zz_log i "Release branch found: {Blue $name}"
2424
fi
2525

@@ -37,7 +37,7 @@ if [ -z "$flow" ] || [ -z "$name" ]; then
3737
fi
3838

3939
# Extract branch name
40-
if ! git checkout $flow/$name; then
40+
if ! git checkout $flow/$name >/dev/null 2>&1; then
4141
zz_log e "Cannot switch to $flow/$name branch"
4242
exit 1
4343
fi
@@ -55,7 +55,7 @@ zz_log i "Bump version: {Blue $GBV}"
5555
GIT_EDITOR=:
5656

5757
# Update version, changelog, and finish release
58-
if bump-changelog -f $GBV -b -m; then
58+
if bump-changelog -f $GBV -b; then
5959
zz_log s "Version & CHANGELOG updated to: {B $GBV}"
6060
if ! git commit -am "chore(release): $GBV"; then
6161
zz_log e "Cannot commit version & CHANGELOG"

0 commit comments

Comments
 (0)