From fb62492cddf3cb423175b7137e6f2207f1b8195a Mon Sep 17 00:00:00 2001 From: letwebdev Date: Mon, 26 Feb 2024 07:13:34 +0800 Subject: [PATCH] fix(`setVersionNumber`): fix logic error of `bump` commit bumped `package.json` before tagging --- scripts/setVersionNumber.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/setVersionNumber.sh b/scripts/setVersionNumber.sh index 9c4860b..188d228 100755 --- a/scripts/setVersionNumber.sh +++ b/scripts/setVersionNumber.sh @@ -26,7 +26,14 @@ if [[ "$1" == "--bump" ]]; then awk --field-separator=. '/[0-9]+./{$NF++;print}' OFS=. )" versionNumberToSet="${versionNumberBumped}" - git tag -a "${versionNumberBumped}" -m "Bump version" + # Substitute version numbers in package.json and commit + sed --in-place --regexp-extended \ + "s/\"version\": \".*\"/\"version\": \"${versionNumberToSet/v/}\"/" \ + "./package.json" + git add "./package.json" + git commit -m "chore: bump to ${versionNumberToSet}" + + git tag -a "${versionNumberToSet}" -m "Bump version" quantitiesOfExistingVersionNumbers+=1 else versionNumberToSet="${existingLatestVersionNumber}" @@ -39,10 +46,6 @@ else versionCode="${quantitiesOfExistingVersionNumbers}" fi -# Substitute version numbers in package.json -sed --in-place --regexp-extended \ - "s/\"version\": \".*\"/\"version\": \"${versionNumberToSet/v/}\"/" \ - "./package.json" # Substitute version numbers in gradle build script ANDROID_PROJECT_DIR="${CAPACITOR_ANDROID_PATH:=./release/android}" ANDROID_BUILD_SCRIPT="${ANDROID_PROJECT_DIR}/app/build.gradle"