We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3b5eac commit c1eda0fCopy full SHA for c1eda0f
.ci/get_version_from_git.sh
@@ -1,8 +1,12 @@
1
#!/bin/sh
2
-TAG=$(git tag | grep -E "[0-9]\.[0-9]\.[0-9]" | sort -rn | head -n1)
+
3
+# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
4
+SEMVER_REGEX="^(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-]+)*))?$"
5
6
+TAG=$(git tag | grep -P "$SEMVER_REGEX" | sed '/-/!{s/$/_/}' | sort -V | sed 's/_$//' | tail -n1)
7
8
if [ -z "${TAG}" ]; then
- echo "Could not find any tag" 1>&2
9
+ echo "Could not find any semver tag" 1>&2
10
exit 1
11
else
12
COMMITS_SINCE_TAG=$(git rev-list "${TAG}".. --count)
0 commit comments