Skip to content

Commit

Permalink
ci: fix finding major versions during release (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
afiune authored Apr 28, 2021
1 parent 5026f00 commit 096acd8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/release_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ tag_release() {
find_latest_version() {
local _pattern="v[0-9]\+.[0-9]\+.[0-9]\+"
local _versions
local _latest
_versions=$(git ls-remote --tags --quiet | grep $_pattern | tr '/' ' ' | awk '{print $NF}')
if [ "$_versions" != "" ]; then
echo "$_versions" | tr '.' ' ' | sort -nr -k 1 -k 2 -k 3 | tr ' ' '.' | head -1
_latest=$(echo "$_versions" | sed 's/v//' | tr '.' ' ' | sort -nr -k 1 -k 2 -k 3 | tr ' ' '.' | head -1)
echo "v$_latest"
else
git rev-list --max-parents=0 HEAD
fi
Expand Down Expand Up @@ -69,7 +71,7 @@ bump_version() {
fi

log "commiting and pushing the version bump to github"
git config --global user.email $git_email
git config --global user.email $git_email
git config --global user.name $git_user
git_add_version_files
git commit -m "chore: version bump to v$VERSION"
Expand Down Expand Up @@ -142,7 +144,7 @@ push_release() {
log "commiting and pushing the release to github"
_version_no_tag=$(echo $VERSION | awk -F. '{printf("%d.%d.%d", $1, $2, $3)}')
if [ "$CI" != "" ]; then
git config --global user.email $git_email
git config --global user.email $git_email
git config --global user.name $git_user
fi
git checkout -B release
Expand Down

0 comments on commit 096acd8

Please sign in to comment.