From 228c042d837fe5e34db37d876b5371a597d954a3 Mon Sep 17 00:00:00 2001 From: Nick Le Large Date: Thu, 21 Nov 2024 07:34:02 +0100 Subject: [PATCH] Remove the "v" during string sanitation to simplify major version extraction --- ...ump-version-and-create-release-and-push-docker-images.yaml | 4 ++-- .github/workflows/compute_version.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bump-version-and-create-release-and-push-docker-images.yaml b/.github/workflows/bump-version-and-create-release-and-push-docker-images.yaml index 0a45ee3e..9d4f5461 100644 --- a/.github/workflows/bump-version-and-create-release-and-push-docker-images.yaml +++ b/.github/workflows/bump-version-and-create-release-and-push-docker-images.yaml @@ -21,8 +21,8 @@ jobs: - name: Compute new version id: bump_version run: | - initial_version=$(source version && echo ${VERSION#v}) - new_version=$(.github/workflows/compute_version.sh "$initial_version" "${{ github.event.pull_request.body }}") + source version + new_version=$(.github/workflows/compute_version.sh "$VERSION" "${{ github.event.pull_request.body }}") echo "new_version=$new_version" >> $GITHUB_OUTPUT update-version-file: diff --git a/.github/workflows/compute_version.sh b/.github/workflows/compute_version.sh index 19bd1e87..f72af2f9 100755 --- a/.github/workflows/compute_version.sh +++ b/.github/workflows/compute_version.sh @@ -7,10 +7,10 @@ if [[ $# -ne 2 ]]; then exit 1 fi -initial_version=${1//[^0-9.v]/} +initial_version=${1//[^0-9.]/} input_string=${2//[^a-zA-Z0-9#]/} -initial_major=$(echo "$initial_version" | cut -d'.' -f1 | cut -d'v' -f2) +initial_major=$(echo "$initial_version" | cut -d'.' -f1) initial_minor=$(echo "$initial_version" | cut -d'.' -f2) initial_patch=$(echo "$initial_version" | cut -d'.' -f3)