Skip to content

Commit

Permalink
gitops: support automatic Source Sem Ver update for '-rc' and '-dev' …
Browse files Browse the repository at this point in the history
…sem ver metadata
  • Loading branch information
boromir674 committed Feb 27, 2024
1 parent 3de8d49 commit 8320453
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scripts/distro-sem-ver-bump.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 8320453

Please sign in to comment.