Skip to content

Commit

Permalink
Fix project version when having only "alpha" tags
Browse files Browse the repository at this point in the history
  • Loading branch information
nebularg committed Jan 24, 2023
1 parent 355bb00 commit 9759c76
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -539,17 +539,22 @@ set_info_git() {
_si_tag=$( git -C "$si_repo_dir" describe --tags --always --abbrev=7 2>/dev/null )
si_tag=$( git -C "$si_repo_dir" describe --tags --always --abbrev=0 2>/dev/null )
# Set $si_project_version to the version number of HEAD. May be empty if there are no commits.
si_project_version=$si_tag
si_project_version="$si_tag"
# The HEAD is not tagged if the HEAD is several commits past the most recent tag.
if [ "$si_tag" = "$si_project_hash" ]; then
# --abbrev=0 expands out the full sha if there was no previous tag
si_project_version=$_si_tag
si_project_version="$_si_tag"
si_previous_tag=
si_tag=
elif [ "$_si_tag" != "$si_tag" ]; then
# not on a tag
si_project_version=$( git -C "$si_repo_dir" describe --tags --abbrev=7 --exclude="*[Aa][Ll][Pp][Hh][Aa]*" 2>/dev/null )
si_previous_tag=$( git -C "$si_repo_dir" describe --tags --abbrev=0 --exclude="*[Aa][Ll][Pp][Hh][Aa]*" 2>/dev/null )
if [[ -n $si_project_version ]]; then
si_previous_tag=$( git -C "$si_repo_dir" describe --tags --abbrev=0 --exclude="*[Aa][Ll][Pp][Hh][Aa]*" 2>/dev/null )
else # no previous non-alpha tag
si_project_version="$_si_tag"
si_previous_tag=
fi
si_tag=
else # we're on a tag, just jump back one commit
if [[ ${si_tag,,} != *"beta"* && ${si_tag,,} != *"alpha"* ]]; then
Expand Down

0 comments on commit 9759c76

Please sign in to comment.