Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix finding major versions during release #10

Merged
merged 1 commit into from
Apr 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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