scripts: imp code

This commit is contained in:
Eugene Burkov 2024-02-14 13:01:30 +03:00
parent f0965058ad
commit 2c184158c0

View File

@ -68,15 +68,6 @@ get_last_minor_zero() {
| head -n 1
}
# get_last_release returns the most recent release tag, regardless whether it's
# patch, minor, or major one.
get_last_release() {
git tag\
| grep -e 'v[0-9]\+\.[0-9]\+\.[0-9]\+$'\
| sort -k 1.2,1nr -k 2,2nr -k 3,3nr -t '.'\
| head -n 1
}
channel="${CHANNEL:?please set CHANNEL}"
readonly channel
@ -141,8 +132,9 @@ in
# This pseudo-channel is used to set a proper versions into release
# candidate builds.
# last_release is the name of the previous release version's tag.
last_release="$( get_last_release )"
# last_tag is expected to be the latest release tag.
last_tag="$( git describe --abbrev=0 )"
readonly last_tag
# current_branch is the name of the branch currently checked out.
current_branch="$( git rev-parse --abbrev-ref HEAD )"
@ -159,11 +151,7 @@ in
exit 1
fi
# release_version is the final version of this release candidate.
release_version="$( echo "$current_branch" | cut -d '-' -f 2 )"
readonly release_version
version="${release_version}-rc.$( git rev-list --count "$last_release"..HEAD )"
version="${current_branch#rc-}-rc.$( git rev-list --count "$last_tag"..HEAD )"
;;
(*)
echo "invalid channel '$channel', supported values are\