Skip to content

Commit

Permalink
scripts: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Feb 14, 2024
1 parent f096505 commit 2c18415
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions scripts/make/version.sh
Expand Up @@ -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

Expand Down Expand Up @@ -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 )"
Expand All @@ -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\
Expand Down

0 comments on commit 2c18415

Please sign in to comment.