From 7f83707449f8e7d0bd750225f655f1c23d057cc9 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Fri, 9 Feb 2024 13:47:04 +0300 Subject: [PATCH] Pull request 2143: AG-29441 QA versions Squashed commit of the following: commit c004644dd6b86847a654764e2055349919ac0de0 Merge: f26ec4440 24baee0f8 Author: Eugene Burkov Date: Fri Feb 9 13:09:44 2024 +0300 Merge branch 'master' into AG-29441-qa-versions commit f26ec4440cd406d0753d1225313b3cc5f60bf3e2 Author: Eugene Burkov Date: Wed Feb 7 13:27:15 2024 +0300 github: imp workflow doc commit 825a00c8dde47f9bc9b837885978a135bfb1dc61 Author: Eugene Burkov Date: Tue Feb 6 18:53:32 2024 +0300 scripts: imp doc commit ef62d96cec66f186799db175a813fca0913482b7 Author: Eugene Burkov Date: Tue Feb 6 15:00:42 2024 +0300 scrits: imp count commit 2d02b23da426063b9a852c06a04ba2fef874b9bf Author: Eugene Burkov Date: Tue Feb 6 14:22:28 2024 +0300 scripts: imp code, docs commit 549bfb982fa32cd30aa339f4458e60b6fc22e53a Author: Eugene Burkov Date: Mon Feb 5 18:54:55 2024 +0300 scripts: imp dev version --- .github/workflows/build.yml | 5 ++++- scripts/make/version.sh | 14 +++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9804dae2..a3cb7c40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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': diff --git a/scripts/make/version.sh b/scripts/make/version.sh index 68e84e9c..42eee5fc 100644 --- a/scripts/make/version.sh +++ b/scripts/make/version.sh @@ -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