Skip to content

Commit c907610

Browse files
committed
Added old/new vers to final summary, eliminated <new|unique>_versions ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/perplexity-omnibox]
1 parent 5e1f68c commit c907610

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

utils/bump.sh

+17-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ MANIFEST_PATH="chromium/extension/manifest.json"
2525
echo -e "${BY}\nBumping version in ${MANIFEST_PATH}...${NC}\n"
2626

2727
# Init BUMP vars
28-
bumped_manifests=() # for final summary
28+
declare -A bumped_manifests=()
2929
TODAY=$(date +'%Y.%-m.%-d') # YYYY.M.D format
3030

3131
# Check LATEST COMMIT for extension changes
@@ -50,28 +50,36 @@ else new_ver="$TODAY" ; fi
5050
# BUMP old version
5151
sed -i "s/\"version\": \"$old_ver\"/\"version\": \"$new_ver\"/" "$MANIFEST_PATH"
5252
echo -e "Updated: ${BW}v${old_ver}${NC}${BG}v${new_ver}${NC}\n"
53-
bumped_manifests+=("$platform_manifest_path/manifest.json")
53+
bumped_manifests["$platform_manifest_path/manifest.json"]="$old_ver;$new_ver"
54+
55+
# LOG manifests bumped
5456
if (( ${#bumped_manifests[@]} == 0 )) ; then echo -e "${BW}Completed. No manifests bumped.${NC}" ; exit 0
55-
else echo -e "${BG}${#bumped_manifests[@]} manifest${plural_suffix} bumped!\n${NC}" ; fi
57+
else echo -e "${BG}${#bumped_manifests[@]} manifest${plural_suffix} bumped!${NC}" ; fi
5658

5759
# ADD/COMMIT/PUSH bump(s)
5860
if [[ "$no_commit" != true ]] ; then
5961
plural_suffix=$((( ${#bumped_manifests[@]} > 1 )) && echo "s")
60-
echo -e "${BY}Committing bump${plural_suffix} to Git...\n${NC}"
61-
COMMIT_MSG="Bumped \`version\`"
62-
unique_versions=($(printf "%s\n" "${new_versions[@]}" | sort -u))
63-
if (( ${#unique_versions[@]} == 1 )) ; then COMMIT_MSG+=" to \`${unique_versions[0]}\`" ; fi
62+
echo -e "\n${BY}Committing bump${plural_suffix} to Git...\n${NC}"
63+
64+
# Init commit msg
65+
COMMIT_MSG="Bumped \`version\` to \`$new_ver\`" ; fi
66+
67+
# git add/commit/push
6468
git add ./**/manifest.json && git commit -n -m "$COMMIT_MSG"
6569
if [[ "$no_push" != true ]] ; then
6670
echo -e "\n${BY}Pulling latest changes from remote to sync local repository...${NC}\n"
6771
git pull || (echo -e "${BR}Merge failed, please resolve conflicts!${NC}" && exit 1)
6872
echo -e "\n${BY}Pushing bump${plural_suffix} to Git...\n${NC}"
6973
git push
7074
fi
75+
7176
git_action="updated"$( [[ "$no_commit" != true ]] && echo -n "/committed" )$(
72-
[[ "$no_push" != true ]] && echo -n "/pushed" )
77+
[[ "$no_push" != true ]] && echo -n "/pushed" )
7378
echo -e "\n${BG}Success! ${#bumped_manifests[@]} manifest${plural_suffix} ${git_action} to GitHub${NC}"
7479
fi
7580

7681
# Final SUMMARY log
77-
for manifest in "${bumped_manifests[@]}" ; do echo -e " ± $manifest" ; done # log manifests bumped
82+
for manifest in "${!bumped_manifests[@]}" ; do
83+
IFS=";" read -r old_ver new_ver <<< "${bumped_manifests[$manifest]}"
84+
echo -e " ± $manifest ${BW}v${old_ver}${NC}${BG}v${new_ver}${NC}"
85+
done

0 commit comments

Comments
 (0)