From 93001cabe81483ef5fa42ca874668121faa15046 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 10 Oct 2020 18:29:06 +0100 Subject: [PATCH] scripting version --- Makefile | 5 ++++- scripts/version.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ version.txt | 2 +- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100755 scripts/version.sh diff --git a/Makefile b/Makefile index a0d825fb..9cc8d449 100644 --- a/Makefile +++ b/Makefile @@ -59,4 +59,7 @@ yavscd: src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc.Server/bin/$(CONFIG)/ mkbundle --static $(DNXLIBS) src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/en/Yavsc.resources.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/en/Yavsc.Server.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/en/Yavsc.Abstract.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/pt/Yavsc.Abstract.resources.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll $(LIBS) -L $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin --machine-config $(MONO_PREFIX)/etc/mono/4.5/machine.config -o yavscd strip yavscd -.PHONY: packages +version-increment-patch: + scripts/version.sh $$(cat version.txt) patch > version.txt + +sPHONY: packages diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100755 index 00000000..f6e09210 --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +version="$1" +major=0 +minor=0 +build=0 + +# break down the version number into it's components +regex="([0-9]+).([0-9]+).([0-9]+)((-[A-Za-z]+)([0-9]+))?" +if [[ $version =~ $regex ]]; then + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + build="${BASH_REMATCH[3]}" + patchtype="${BASH_REMATCH[5]}" + patchnum="${BASH_REMATCH[6]}" +fi + +# check paramater to see which number to increment +if [[ "$2" == "feature" ]]; then + minor=$(echo $minor + 1 | bc) + build=0 + patchtype= + patchnum= +elif [[ "$2" == "build" ]]; then + build=$(echo $build + 1 | bc) + patchtype= + patchnum= +elif [[ "$2" == "major" ]]; then + major=$(echo $major+1 | bc) + minor=0 + build=0 + patchtype= + patchnum= +elif [[ "$2" == "patch" ]]; then + patchnum=$(echo $patchnum + 1 | bc) +else + echo "usage: ./version.sh version_number [major/feature/build/patch]" >&2 + + exit -1 +fi + +# echo the new version number +echo "${major}.${minor}.${build}${patchtype}${patchnum}" + diff --git a/version.txt b/version.txt index cae7f72e..486a97a0 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.6-rc14 +1.0.6-rc15