Skip to content

Commit

Permalink
fix: handle repos without version tags
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesw committed Oct 10, 2024
1 parent a1a326d commit 0da8f63
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions version-bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ GITHUB_OUTPUT=${GITHUB_OUTPUT:-/tmp/$NAME.$USER}
# main
#
#set -x

echo "git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags origin '*.*.*' | grep \"$prefix_search_arg\" | tail -n1 | cut -d '/' -f 3"
version=`git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags origin '*.*.*' | grep "$prefix_search_arg" | tail -n1 | cut -d '/' -f 3`

if ! version=`git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags origin '*.*.*' | grep "$prefix_search_arg" | tail -n1 | cut -d '/' -f 3` ;then
version='v0.0.0'
fi

version_numeric="$(echo $version | tr -dc '[:digit:].')"
echo "version: $version"
echo "version_numeric: $version_numeric"
Expand Down Expand Up @@ -246,7 +249,6 @@ fi

new_tag_numeric="$(echo $new_tag | tr -dc '[:digit:].')"


echo "version_last=${version}" >> "$GITHUB_OUTPUT" 2>/dev/null
echo "version_last_numeric=${version_numeric}" >> "$GITHUB_OUTPUT" 2>/dev/null

Expand Down

0 comments on commit 0da8f63

Please sign in to comment.