From 9a6c460fd66d9622d99cb59aa19f430c98aef4d7 Mon Sep 17 00:00:00 2001 From: Jakob Harder <12190313+jakobharder@users.noreply.github.com> Date: Sun, 25 Feb 2024 13:04:10 +0100 Subject: [PATCH] remove hash from git describe --- source/Burntime.MonoGame/get-file-version.bat | 30 +++++++++--------- .../Burntime.MonoGame/get-product-version.bat | 2 +- .../Burntime.MonoGame/get-semver-version.bat | 31 ++++++++++--------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/source/Burntime.MonoGame/get-file-version.bat b/source/Burntime.MonoGame/get-file-version.bat index e508dff..b7c4a6a 100644 --- a/source/Burntime.MonoGame/get-file-version.bat +++ b/source/Burntime.MonoGame/get-file-version.bat @@ -5,23 +5,25 @@ :: v1.2.3-1-asdf -> 1.2.3.1 :: v1.2-1-asdf -> 1.2.0.1 -FOR /F "tokens=1-3 delims==v-" %%i IN ('git describe --tags') DO ( - IF "%%j%%k" == "" ( - echo %%i - ) - IF NOT "%%j" == "" ( - IF "%%k" == "" ( +FOR /F "tokens=1 delims==v+" %%n IN ('git describe --tags') DO ( + FOR /F "tokens=1-3 delims==-" %%i IN ("%%n") DO ( + IF "%%j%%k" == "" ( echo %%i ) - IF NOT "%%k" == "" ( - FOR /F "tokens=1-3 delims==." %%s IN ("%%i") DO ( - IF "%%u" == "" ( - echo %%i.0.%%j - ) - IF NOT "%%u" == "" ( - echo %%i.%%j + IF NOT "%%j" == "" ( + IF "%%k" == "" ( + echo %%i + ) + IF NOT "%%k" == "" ( + FOR /F "tokens=1-3 delims==." %%s IN ("%%i") DO ( + IF "%%u" == "" ( + echo %%i.0.%%j + ) + IF NOT "%%u" == "" ( + echo %%i.%%j + ) ) ) ) ) -) +) \ No newline at end of file diff --git a/source/Burntime.MonoGame/get-product-version.bat b/source/Burntime.MonoGame/get-product-version.bat index e32bf99..32796ac 100644 --- a/source/Burntime.MonoGame/get-product-version.bat +++ b/source/Burntime.MonoGame/get-product-version.bat @@ -4,6 +4,6 @@ :: v1.2.3-rc1 -> 1.2.3-rc1 :: v1.2.3-1-asdf -> 1.2.3-1-asdf -FOR /F "tokens=1-2 delims==v" %%i IN ('git describe --tags') DO ( +FOR /F "tokens=1-2 delims==v+" %%i IN ('git describe --tags') DO ( echo %%i ) diff --git a/source/Burntime.MonoGame/get-semver-version.bat b/source/Burntime.MonoGame/get-semver-version.bat index 209a5b1..9f61026 100644 --- a/source/Burntime.MonoGame/get-semver-version.bat +++ b/source/Burntime.MonoGame/get-semver-version.bat @@ -4,22 +4,25 @@ :: v1.2.3-rc1 -> 1.2.3-rc1 :: v1.2.3-1-asdf -> 1.2.3.1 :: v1.2-1-asdf -> 1.2.0.1 +:: v1.2.3-rc1+abc -> 1.2.3-rc1 -FOR /F "tokens=1-3 delims==v-" %%i IN ('git describe --tags') DO ( - IF "%%j%%k" == "" ( - echo %%i - ) - IF NOT "%%j" == "" ( - IF "%%k" == "" ( - echo %%i-%%j +FOR /F "tokens=1 delims==v+" %%n IN ('git describe --tags') DO ( + FOR /F "tokens=1-3 delims==-" %%i IN ("%%n") DO ( + IF "%%j%%k" == "" ( + echo %%i ) - IF NOT "%%k" == "" ( - FOR /F "tokens=1-3 delims==." %%s IN ("%%i") DO ( - IF "%%u" == "" ( - echo %%i.0.%%j - ) - IF NOT "%%u" == "" ( - echo %%i.%%j + IF NOT "%%j" == "" ( + IF "%%k" == "" ( + echo %%i-%%j + ) + IF NOT "%%k" == "" ( + FOR /F "tokens=1-3 delims==." %%s IN ("%%i") DO ( + IF "%%u" == "" ( + echo %%i.0.%%j + ) + IF NOT "%%u" == "" ( + echo %%i.%%j + ) ) ) )