Skip to content

Commit c9a3250

Browse files
committed
add scripts
1 parent 7344137 commit c9a3250

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Diff for: scripts/tag_semver.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
MAJOR_VERSION=$1
5+
MINOR_VERSION=$2
6+
TAG_PREFIX=$3
7+
8+
# find the latest tag
9+
NEW_VERSION="${TAG_PREFIX}v${MAJOR_VERSION}.${MINOR_VERSION}.0"
10+
git fetch -q --tags --prune --prune-tags
11+
tags=$(git tag -l ${TAG_PREFIX}v${MAJOR_VERSION}.${MINOR_VERSION}.* --sort=-version:refname)
12+
if [[ ! -z "$tags" ]]; then
13+
arr=(${tags})
14+
for val in ${arr[@]}; do
15+
if [[ "$val" =~ ^${TAG_PREFIX}v${MAJOR_VERSION}+\.${MINOR_VERSION}\.[0-9]+$ ]]; then
16+
prev_build=$(echo ${val} | cut -d. -f3)
17+
new_build=$((prev_build+1))
18+
NEW_VERSION="${TAG_PREFIX}v${MAJOR_VERSION}.${MINOR_VERSION}.${new_build}"
19+
break
20+
fi
21+
done
22+
fi
23+
24+
echo "Version for this commit: ${NEW_VERSION}"
25+
echo "RELEASE_VERSION=${NEW_VERSION}" >> variables.env

0 commit comments

Comments
 (0)