-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix_3811: send semver version in api/stattus/buildinfo for cloud depl…
…oyments (#4110) * fix(tools): fix github action * fix(tools): use correct ref fr v4 * fix(tools): use correct ref * fix(tools): fecth tags * fix(tools): fetch tags * fix(tools): use tag directly during build * Revert "fix(tools): use tag directly during build" This reverts commit 5cbd055. * fix(tools): inject tag as version directly during build
- Loading branch information
Showing
5 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
REPO_ROOT=$(git rev-parse --show-toplevel) | ||
|
||
is_valid_semver() { | ||
local version=$1 | ||
# regex taken from https://semver.org/ | ||
if [[ $version =~ ^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ ]] ;then | ||
return 1 | ||
else | ||
return 0 | ||
fi | ||
} | ||
|
||
|
||
VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) | ||
if is_valid_semver "$VERSION"; then | ||
echo "$VERSION" | ||
exit 0 | ||
fi | ||
|
||
|
||
source "${REPO_ROOT}/tools/image-tag" |