all: sync with master
This commit is contained in:
@@ -25,8 +25,7 @@
|
||||
verbose="${VERBOSE:-0}"
|
||||
readonly verbose
|
||||
|
||||
if [ "$verbose" -gt '0' ]
|
||||
then
|
||||
if [ "$verbose" -gt '0' ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
@@ -62,20 +61,20 @@ get_last_minor_zero() {
|
||||
# second field (",2"). The sort is also numeric and reverse ("nr").
|
||||
#
|
||||
# Finally, get the top (that is, most recent) version.
|
||||
git tag\
|
||||
| grep -e 'v[0-9]\+\.[0-9]\+\.0$'\
|
||||
| sort -k 1.2,1nr -k 2,2nr -t '.'\
|
||||
| head -n 1
|
||||
git tag \
|
||||
| grep -e 'v[0-9]\+\.[0-9]\+\.0$' \
|
||||
| sort -k 1.2,1nr -k 2,2nr -t '.' \
|
||||
| head -n 1 \
|
||||
;
|
||||
}
|
||||
|
||||
channel="${CHANNEL:?please set CHANNEL}"
|
||||
readonly channel
|
||||
|
||||
case "$channel"
|
||||
in
|
||||
('development')
|
||||
case "$channel" in
|
||||
'development')
|
||||
# commit_number is the number of current commit within the branch.
|
||||
commit_number="$( git rev-list --count master..HEAD )"
|
||||
commit_number="$(git rev-list --count master..HEAD)"
|
||||
readonly commit_number
|
||||
|
||||
# The development builds are described with a combination of unset semantic
|
||||
@@ -83,21 +82,21 @@ in
|
||||
#
|
||||
# v0.0.0-dev.5-a1b2c3d4
|
||||
#
|
||||
version="v0.0.0-dev.${commit_number}+$( git rev-parse --short HEAD )"
|
||||
version="v0.0.0-dev.${commit_number}+$(git rev-parse --short HEAD)"
|
||||
;;
|
||||
('edge')
|
||||
'edge')
|
||||
# last_minor_zero is the last new minor release.
|
||||
last_minor_zero="$( get_last_minor_zero )"
|
||||
last_minor_zero="$(get_last_minor_zero)"
|
||||
readonly last_minor_zero
|
||||
|
||||
# num_commits_since_minor is the number of commits since the last new
|
||||
# minor release. If the current commit is the new minor release,
|
||||
# num_commits_since_minor is zero.
|
||||
num_commits_since_minor="$( git rev-list --count "${last_minor_zero}..HEAD" )"
|
||||
num_commits_since_minor="$(git rev-list --count "${last_minor_zero}..HEAD")"
|
||||
readonly num_commits_since_minor
|
||||
|
||||
# next_minor is the next minor release version.
|
||||
next_minor="$( echo "$last_minor_zero" | awk -F '.' "$bump_minor" )"
|
||||
next_minor="$(echo "$last_minor_zero" | awk -F '.' "$bump_minor")"
|
||||
readonly next_minor
|
||||
|
||||
# Make this commit a prerelease version for the next minor release. For
|
||||
@@ -106,21 +105,20 @@ in
|
||||
#
|
||||
# v0.124.0-a.5+a1b2c3d4
|
||||
#
|
||||
version="${next_minor}-a.${num_commits_since_minor}+$( git rev-parse --short HEAD )"
|
||||
version="${next_minor}-a.${num_commits_since_minor}+$(git rev-parse --short HEAD)"
|
||||
;;
|
||||
('beta'|'release')
|
||||
'beta' | 'release')
|
||||
# current_desc is the description of the current git commit. If the
|
||||
# current commit is tagged, git describe will show the tag.
|
||||
current_desc="$( git describe )"
|
||||
current_desc="$(git describe)"
|
||||
readonly current_desc
|
||||
|
||||
# last_tag is the most recent git tag.
|
||||
last_tag="$( git describe --abbrev=0 )"
|
||||
last_tag="$(git describe --abbrev=0)"
|
||||
readonly last_tag
|
||||
|
||||
# Require an actual tag for the beta and final releases.
|
||||
if [ "$current_desc" != "$last_tag" ]
|
||||
then
|
||||
if [ "$current_desc" != "$last_tag" ]; then
|
||||
echo 'need a tag' 1>&2
|
||||
|
||||
exit 1
|
||||
@@ -128,41 +126,39 @@ in
|
||||
|
||||
version="$last_tag"
|
||||
;;
|
||||
('candidate')
|
||||
'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 )"
|
||||
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 )"
|
||||
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
|
||||
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 )"
|
||||
version="${current_branch#rc-}-rc.$(git rev-list --count "$last_tag"..HEAD)"
|
||||
;;
|
||||
(*)
|
||||
echo "invalid channel '$channel', supported values are\
|
||||
*)
|
||||
echo "invalid channel '$channel', supported values are \
|
||||
'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]+(-(a|b|dev|rc)\.[0-9]+)?(\+[[:xdigit:]]+)?$' -q
|
||||
then
|
||||
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
|
||||
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user