Skip to content

Commit 3757e24

Browse files
committed
fix(scripts): New version and release scripts
1 parent 6fa80e1 commit 3757e24

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

scripts/release/new-version.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,27 @@ function menu() {
4747
printf "4 - Exit\n"
4848
read -r selection
4949

50+
51+
TAG_COMMIT=$(git rev-list --tags --max-count=1)
52+
CURRENT_TAG=$(git describe --tags --always ${TAG_COMMIT})
53+
if [ -z "${TAG_COMMIT}" ]
54+
then
55+
CURRENT_TAG="v0.0.0"
56+
fi
57+
58+
5059
case "$selection" in
5160
1)
5261
printf "Major updates......\n"
53-
NEW_VERSION=$(git tag | sed 's/\(.*v\)\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2;\3;\4;\1/g' | sort -t';' -k 1,1n -k 2,2n -k 3,3n | tail -n 1 | awk -F';' '{printf "%s%d.%d.%d", $4, ($1+1),0,0 }')
62+
NEW_VERSION=$(echo "${CURRENT_TAG}" | sed 's/\(.*v\)\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2;\3;\4;\1/g' | sort -t';' -k 1,1n -k 2,2n -k 3,3n | tail -n 1 | awk -F';' '{printf "%s%d.%d.%d", $4, ($1+1),0,0 }')
5463
;;
5564
2)
5665
printf "Run Minor update.........\n"
57-
NEW_VERSION=$(git tag | sed 's/\(.*v\)\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2;\3;\4;\1/g' | sort -t';' -k 1,1n -k 2,2n -k 3,3n | tail -n 1 | awk -F';' '{printf "%s%d.%d.%d", $4, $1,($2+1),0 }')
66+
NEW_VERSION=$(echo "${CURRENT_TAG}" | sed 's/\(.*v\)\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2;\3;\4;\1/g' | sort -t';' -k 1,1n -k 2,2n -k 3,3n | tail -n 1 | awk -F';' '{printf "%s%d.%d.%d", $4, $1,($2+1),0 }')
5867
;;
5968
3)
6069
printf "Patch update.........\n"
61-
NEW_VERSION=$(git tag | sed 's/\(.*v\)\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2;\3;\4;\1/g' | sort -t';' -k 1,1n -k 2,2n -k 3,3n | tail -n 1 | awk -F';' '{printf "%s%d.%d.%d", $4, $1,$2,($3 + 1) }')
70+
NEW_VERSION=$(echo "${CURRENT_TAG}" | sed 's/\(.*v\)\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2;\3;\4;\1/g' | sort -t';' -k 1,1n -k 2,2n -k 3,3n | tail -n 1 | awk -F';' '{printf "%s%d.%d.%d", $4, $1,$2,($3 + 1) }')
6271
;;
6372
4)
6473
printf "Exit................................\n"
@@ -83,19 +92,15 @@ menu
8392

8493
NEW_TAG=${NEW_VERSION}
8594

86-
TAG_COMMIT=$(git rev-list --tags --max-count=1)
87-
CURRENT_TAG=$(git describe --tags "${TAG_COMMIT}")
88-
CHANGELOG="$(git log --pretty=format:"%s" HEAD..."${CURRENT_TAG}")"
89-
90-
9195
echo "New version is: ${NEW_TAG}"
96+
9297
while true; do
9398
echo "Is it ok? (:y)?:"
9499
read -r yn
95100
case $yn in
96101
[Yy]*)
97102

98-
git tag -a "${NEW_TAG}" -m "${CHANGELOG}" && \
103+
git tag -a "${NEW_TAG}" && \
99104
git push --tags
100105

101106
break

scripts/release/release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ git fetch --tags -f
1919
export BUILD_COMMIT=$(git rev-parse HEAD)
2020
export BUILD_SHORTCOMMIT=$(git rev-parse --short HEAD)
2121
export BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
22-
export BUILD_VERSION=$(git describe --tags --always $(git rev-list --tags --max-count=1))
22+
CURRENT_TAG_COMMIT=$(git rev-list --tags --max-count=1)
23+
export BUILD_VERSION=$(git describe --tags --always ${CURRENT_TAG_COMMIT})
2324

2425
export BUILD_APPNAME=bitech-go-shared
2526

0 commit comments

Comments
 (0)