diff --git a/.github/workflows/renovate-bump.yaml b/.github/workflows/renovate-bump.yaml index 40483e0e4d8..d7feeecf38f 100644 --- a/.github/workflows/renovate-bump.yaml +++ b/.github/workflows/renovate-bump.yaml @@ -23,13 +23,6 @@ jobs: fetch-depth: 0 ref: master path: master - - name: Set up Python - uses: actions/setup-python@v2 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pybump - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - uses: dorny/paths-filter@v2 id: filter with: @@ -68,7 +61,7 @@ jobs: echo "Version does not have to be bumped" else echo "Bumping patch version for ${train}/${chart}" - pybump bump --file ./charts/${train}/${chart}/Chart.yaml --level patch + ./bump.sh patch ./charts/${train}/${chart}/Chart.yaml fi done - name: Cleanup diff --git a/tools/bump-major.sh b/tools/bump-major.sh deleted file mode 100755 index 46173faec38..00000000000 --- a/tools/bump-major.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -eu - -# This script requires pyBump to be installed using pip. - -for train in stable incubator develop non-free deprecated; do - for chart in charts/${train}/*; do - if [ -d "${chart}" ]; then - echo "Bumping patch version for ${train}/${chart}" - pybump bump --file ${chart}/Chart.yaml --level major - fi - done -done diff --git a/tools/bump-minor.sh b/tools/bump-minor.sh deleted file mode 100755 index 0a648410c54..00000000000 --- a/tools/bump-minor.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -eu - -# This script requires pyBump to be installed using pip. - -for train in stable incubator develop non-free deprecated; do - for chart in charts/${train}/*; do - if [ -d "${chart}" ]; then - echo "Bumping patch version for ${train}/${chart}" - pybump bump --file ${chart}/Chart.yaml --level minor - fi - done -done diff --git a/tools/bump-patch.sh b/tools/bump-patch.sh deleted file mode 100755 index c353fc7bd51..00000000000 --- a/tools/bump-patch.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -eu - -# This script requires pyBump to be installed using pip. - -for train in stable incubator develop non-free deprecated; do - for chart in charts/${train}/*; do - if [ -d "${chart}" ]; then - echo "Bumping patch version for ${train}/${chart}" - pybump bump --file ${chart}/Chart.yaml --level patch - fi - done -done diff --git a/tools/bump.sh b/tools/bump.sh new file mode 100644 index 00000000000..71e9532c923 --- /dev/null +++ b/tools/bump.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +set -eu + +## General file setup +# $1 bump type +# $2 path to chart if one chart only + + +## Function details +# $1 - semver string +# $2 - level to incr {patch,minor,major} - patch by default +function incr_semver() { + IFS='.' read -ra ver <<< "$1" + [[ "${#ver[@]}" -ne 3 ]] && echo "Invalid semver string" && return 1 + [[ "$#" -eq 1 ]] && level='patch' || level=$2 + + patch=${ver[2]} + minor=${ver[1]} + major=${ver[0]} + + case $level in + patch) + patch=$((patch+1)) + ;; + minor) + patch=0 + minor=$((minor+1)) + ;; + major) + patch=0 + minor=0 + major=$((major+1)) + ;; + *) + echo "Invalid level passed" + return 2 + esac + echo "$major.$minor.$patch" +} + +BUMPTYPE=${1} +if [ -z ${2+x} ]; then +for train in stable incubator develop non-free deprecated; do + for chart in charts/${train}/*; do + if [ -d "${chart}" ]; then + echo "Bumping patch version for ${train}/${chart}" + OLDVER=$(cat ${chart}/chart.yaml | grep "^version: ") + OLDVER=${OLDVER#version: } + NEWVER=$(incr_semver ${OLDVER} ${BUMPTYPE}) + sed -i "s|^version:.*|version: ${NEWVER}|g" ${chart}/chart.yaml + fi + done +done +else + chart=${2} + if [ -d "${chart}" ]; then + echo "Bumping patch version for ${chart}" + OLDVER=$(cat ${chart}/chart.yaml | grep "^version: ") + OLDVER=${OLDVER#version: } + NEWVER=$(incr_semver ${OLDVER} ${BUMPTYPE}) + sed -i "s|^version:.*|version: ${NEWVER}|g" ${chart}/chart.yaml + fi +fi