all: partially sync with master; upd chlog
This commit is contained in:
@@ -43,7 +43,7 @@ bump_minor='/^v[0-9]+\.[0-9]+\.0$/ {
|
||||
}
|
||||
|
||||
{
|
||||
printf("invalid release version: \"%s\"\n", $0);
|
||||
printf("invalid minor release version: \"%s\"\n", $0);
|
||||
|
||||
exit 1;
|
||||
}'
|
||||
@@ -74,8 +74,16 @@ readonly channel
|
||||
case "$channel"
|
||||
in
|
||||
('development')
|
||||
# Use the dummy version for development builds.
|
||||
version='v0.0.0'
|
||||
# commit_number is the number of current commit within the branch.
|
||||
commit_number="$( git rev-list --count master..HEAD )"
|
||||
readonly commit_number
|
||||
|
||||
# The development builds are described with a combination of unset semantic
|
||||
# version, the commit's number within the branch, and the commit hash, e.g.:
|
||||
#
|
||||
# v0.0.0-dev.5-a1b2c3d4
|
||||
#
|
||||
version="v0.0.0-dev.${commit_number}+$( git rev-parse --short HEAD )"
|
||||
;;
|
||||
('edge')
|
||||
# last_minor_zero is the last new minor release.
|
||||
@@ -120,15 +128,40 @@ in
|
||||
|
||||
version="$last_tag"
|
||||
;;
|
||||
('candidate')
|
||||
# This pseudo-channel is used to set a proper versions into release
|
||||
# candidate builds.
|
||||
|
||||
# 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 )"
|
||||
readonly current_branch
|
||||
|
||||
# The branch should be named like:
|
||||
#
|
||||
# rc-v12.34.56
|
||||
#
|
||||
if ! echo "$current_branch" | grep -E -e '^rc-v[0-9]+\.[0-9]+\.[0-9]+$' -q
|
||||
then
|
||||
echo "invalid release candidate branch name '$current_branch'" 1>&2
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="${current_branch#rc-}-rc.$( git rev-list --count "$last_tag"..HEAD )"
|
||||
;;
|
||||
(*)
|
||||
echo "invalid channel '$channel', supported values are\
|
||||
'development', 'edge', 'beta', and 'release'" 1>&2
|
||||
'development', 'edge', 'beta', 'release' and 'candidate'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Finally, make sure that we don't output invalid versions.
|
||||
if ! echo "$version" | grep -E -e '^v[0-9]+\.[0-9]+\.[0-9]+(-[ab]\.[0-9]+)?(\+[[:xdigit:]]+)?$' -q
|
||||
if ! echo "$version" | grep -E -e '^v[0-9]+\.[0-9]+\.[0-9]+(-(a|b|dev|rc)\.[0-9]+)?(\+[[:xdigit:]]+)?$' -q
|
||||
then
|
||||
echo "generated an invalid version '$version'" 1>&2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user