From 2a9fef16fc951394595ea806b00bb277129c1c62 Mon Sep 17 00:00:00 2001 From: Jack McKernan Date: Sat, 15 Jan 2022 19:53:13 -0600 Subject: [PATCH] Fix stripping the date suffix from versions. current_version included '2021', current year was 2022, so the expansion didn't work. --- common.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common.sh b/common.sh index 8c1bc88..e8153ec 100644 --- a/common.sh +++ b/common.sh @@ -3,8 +3,8 @@ function bump-nuspec-version() { package="${1}" new_version="${2}" - new_version_without_year="${new_version%.$(date +%Y)*}" - new_maj_min="${new_version_without_year%.*}" + new_version_without_date=$(echo "${new_version}" | sed -r 's|\.[0-9]{8}$||') # Strip the YYYYMMDD suffix if present + new_maj_min="${new_version_without_date%.*}" if [ -z "${package}" ] || [ -z "${new_version}" ]; then echo "Usage: ${FUNCNAME[0]} PACKAGE_NAME VERSION" @@ -12,15 +12,15 @@ function bump-nuspec-version() { fi current_version=$(sed -nr 's|(.+)|\1|p' "${package}.nuspec" | xargs) - current_version_without_year="${current_version%.$(date +%Y)*}" - current_maj_min="${current_version%.*}" + current_version_without_date=$(echo "${current_version}" | sed -r 's|\.[0-9]{8}$||') # Strip the YYYYMMDD suffix if present + current_maj_min="${current_version_without_date%.*}" echo "Current package version: ${current_version}" - echo "Current version: ${current_version_without_year}" + echo "Current version: ${current_version_without_date}" echo "Major minor: ${current_maj_min}" echo echo "New version: ${new_version}" - echo "New version: ${new_version_without_year}" + echo "New version: ${new_version_without_date}" echo "Major minor: ${new_maj_min}" echo @@ -36,7 +36,7 @@ function bump-nuspec-version() { # Replace the full version # Replace the major.minor version sed -r -i "s|${current_version}|${new_version}|g" "${package}.nuspec" - sed -r -i "s|${current_version_without_year}|${new_version_without_year}|g" "${package}.nuspec" + sed -r -i "s|${current_version_without_date}|${new_version_without_date}|g" "${package}.nuspec" sed -r -i "s|${current_maj_min}|${new_maj_min}|g" "${package}.nuspec" }