@@ -25,7 +25,7 @@ MANIFEST_PATH="chromium/extension/manifest.json"
25
25
echo -e " ${BY} \nBumping version in ${MANIFEST_PATH} ...${NC} \n"
26
26
27
27
# Init BUMP vars
28
- bumped_manifests=() # for final summary
28
+ declare -A bumped_manifests=()
29
29
TODAY=$( date +' %Y.%-m.%-d' ) # YYYY.M.D format
30
30
31
31
# Check LATEST COMMIT for extension changes
@@ -50,28 +50,36 @@ else new_ver="$TODAY" ; fi
50
50
# BUMP old version
51
51
sed -i " s/\" version\" : \" $old_ver \" /\" version\" : \" $new_ver \" /" " $MANIFEST_PATH "
52
52
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
54
56
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
56
58
57
59
# ADD/COMMIT/PUSH bump(s)
58
60
if [[ " $no_commit " != true ]] ; then
59
61
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
64
68
git add ./** /manifest.json && git commit -n -m " $COMMIT_MSG "
65
69
if [[ " $no_push " != true ]] ; then
66
70
echo -e " \n${BY} Pulling latest changes from remote to sync local repository...${NC} \n"
67
71
git pull || (echo -e " ${BR} Merge failed, please resolve conflicts!${NC} " && exit 1)
68
72
echo -e " \n${BY} Pushing bump${plural_suffix} to Git...\n${NC} "
69
73
git push
70
74
fi
75
+
71
76
git_action=" updated" $( [[ " $no_commit " != true ]] && echo -n " /committed" ) $(
72
- [[ " $no_push " != true ]] && echo -n " /pushed" )
77
+ [[ " $no_push " != true ]] && echo -n " /pushed" )
73
78
echo -e " \n${BG} Success! ${# bumped_manifests[@]} manifest${plural_suffix} ${git_action} to GitHub${NC} "
74
79
fi
75
80
76
81
# 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