Skip to content

Commit

Permalink
Update entrypoint.sh to allow initial version of bumping
Browse files Browse the repository at this point in the history
  • Loading branch information
ynnoig authored Dec 8, 2023
1 parent 334a3e6 commit 457e858
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,29 @@ preTagFmt="^v?[0-9]+\.[0-9]+\.[0-9]+(-$suffix\.[0-9]+)?$"
case "$tag_context" in
*repo*)
taglist="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | grep -E "$tagFmt")"
tag="$(semver $taglist | tail -n 1)"
if [ -n "$taglist"]
then
tag="$(semver $taglist | tail -n 1)"
fi

pre_taglist="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | grep -E "$preTagFmt")"
pre_tag="$(semver $pre_taglist | tail -n 1)"
if [ -n "$taglist"]
then
pre_tag="$(semver $pre_taglist | tail -n 1)"
fi
;;
*branch*)
taglist="$(git tag --list --merged HEAD --sort=-v:refname | grep -E "$tagFmt")"
tag="$(semver $taglist | tail -n 1)"
if [ -n "$taglist"]
then
tag="$(semver $taglist | tail -n 1)"
fi

pre_taglist="$(git tag --list --merged HEAD --sort=-v:refname | grep -E "$preTagFmt")"
pre_tag=$(semver $pre_taglist | tail -n 1)
if [ -n "$taglist"]
then
pre_tag="$(semver $pre_taglist | tail -n 1)"
fi
;;
* ) echo "Unrecognised context"; exit 1;;
esac
Expand All @@ -86,15 +98,22 @@ then
then
pre_tag="$initial_version"
fi
tag_commit="none"
pre_tag_commit="none"
else
log=$(git log $tag..HEAD --pretty='%B')
fi

# get current commit hash for tag
tag_commit=$(git rev-list -n 1 $tag)

# get current commit hash for tag
tag_commit=$(git rev-list -n 1 $tag)

# get current commit hash for pre_tag
pre_tag_commit=$(git rev-list -n 1 $pre_tag)
if [ -n "$pre_tag" ]
then
# get current commit hash for pre_tag
pre_tag_commit=$(git rev-list -n 1 $pre_tag)
else
pre_tag_commit="none"
fi
fi

# get current commit hash
commit=$(git rev-parse HEAD)
Expand Down Expand Up @@ -149,7 +168,7 @@ echo $part
# prefix with 'v'
if $with_v
then
new="v$new"
new="v$new"
fi

if [ ! -z $custom_tag ]
Expand Down

0 comments on commit 457e858

Please sign in to comment.