From 832045300138b243dce1afba8182f664ece4514d Mon Sep 17 00:00:00 2001 From: konstantinos Date: Tue, 27 Feb 2024 14:20:15 +0200 Subject: [PATCH] gitops: support automatic Source Sem Ver update for '-rc' and '-dev' sem ver metadata --- scripts/distro-sem-ver-bump.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/distro-sem-ver-bump.sh b/scripts/distro-sem-ver-bump.sh index e33f48e3..debba46d 100644 --- a/scripts/distro-sem-ver-bump.sh +++ b/scripts/distro-sem-ver-bump.sh @@ -1,22 +1,28 @@ #!/usr/bin/env sh VERSION="${1}" -GITHUB_ORG="${2:-boromir674}" -REPO="${3:-cookiecutter-python}" +# GITHUB_ORG="${2:-boromir674}" +# REPO="${3:-cookiecutter-python}" # CONSTANTS +# Sem Ver Major Minor Patch + Pre-release metadata +regex="[0-9]+\.[0-9]+\.[0-9]+(?:\-[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*)?" + VERSION_VAR='__version__' + # DISTRO Sem Ver ## Python Poetry BUILD - Bound - Sem Ver PYPROJECT='pyproject.toml' -sed -i.bak -E "s/(version = ['\"])[0-9]+\.[0-9]+\.[0-9]+(['\"])/\\1${VERSION}\\2/" "${PYPROJECT}" && rm "${PYPROJECT}.bak" +# sed -i.bak -E "s/(version = ['\"])[0-9]+\.[0-9]+\.[0-9]+(['\"])/\\1${VERSION}\\2/" "${PYPROJECT}" && rm "${PYPROJECT}.bak" +sed -i.bak -E "s/(version = ['\"])${regex}(['\"])/\\1${VERSION}\\2/" "${PYPROJECT}" && rm "${PYPROJECT}.bak" ## Project Specific - Bound - Sem Ver INIT_FILE='src/cookiecutter_python/__init__.py' -sed -i.bak -E "s/(${VERSION_VAR} = ['\"])[0-9]+\.[0-9]+\.[0-9]+(['\"])/\\1${VERSION}\\2/" "${INIT_FILE}" && rm "${INIT_FILE}.bak" +# sed -i.bak -E "s/(${VERSION_VAR} = ['\"])[0-9]+\.[0-9]+\.[0-9]+(['\"])/\\1${VERSION}\\2/" "${INIT_FILE}" && rm "${INIT_FILE}.bak" +sed -i.bak -E "s/(${VERSION_VAR} = ['\"])${regex}(['\"])/\\1${VERSION}\\2/" "${INIT_FILE}" && rm "${INIT_FILE}.bak" ## Other Builds