Pull request 2143: AG-29441 QA versions

Squashed commit of the following:

commit c004644dd6b86847a654764e2055349919ac0de0
Merge: f26ec4440 24baee0f8
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Fri Feb 9 13:09:44 2024 +0300

    Merge branch 'master' into AG-29441-qa-versions

commit f26ec4440cd406d0753d1225313b3cc5f60bf3e2
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Wed Feb 7 13:27:15 2024 +0300

    github: imp workflow doc

commit 825a00c8dde47f9bc9b837885978a135bfb1dc61
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Feb 6 18:53:32 2024 +0300

    scripts: imp doc

commit ef62d96cec66f186799db175a813fca0913482b7
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Feb 6 15:00:42 2024 +0300

    scrits: imp count

commit 2d02b23da426063b9a852c06a04ba2fef874b9bf
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Feb 6 14:22:28 2024 +0300

    scripts: imp code, docs

commit 549bfb982fa32cd30aa339f4458e60b6fc22e53a
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Mon Feb 5 18:54:55 2024 +0300

    scripts: imp dev version
This commit is contained in:
Eugene Burkov 2024-02-09 13:47:04 +03:00
parent 24baee0f8e
commit 7f83707449
2 changed files with 15 additions and 4 deletions

View file

@ -101,7 +101,10 @@
- 'name': 'Set up Docker Buildx'
'uses': 'docker/setup-buildx-action@v1'
- 'name': 'Run snapshot build'
'run': 'make SIGN=0 VERBOSE=1 build-release build-docker'
# Set a custom version string, since the checkout@v2 action does not seem
# to know about the master branch, while the version script uses it to
# count the number of commits within the branch.
'run': 'make SIGN=0 VERBOSE=1 VERSION="v0.0.0-github" build-release build-docker'
'notify':
'needs':

View file

@ -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.
@ -128,7 +136,7 @@ in
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)\.[0-9]+)?(\+[[:xdigit:]]+)?$' -q
then
echo "generated an invalid version '$version'" 1>&2