File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 25
25
# Variables
26
26
tag_regex=' v[0-9]+\.[0-9]+\.[0-9]+$'
27
27
tag_glob=' v[0-9].[0-9].[0-9]*'
28
+ git_remote=' origin'
29
+ major_tag_regex=' \(v[0-9]*\)'
28
30
29
31
# Terminal colors
30
32
OFF=' \033[0m'
@@ -75,4 +77,20 @@ echo -e "Tagged: ${BOLD_GREEN}$new_tag${OFF}"
75
77
# Push the new tag to the remote
76
78
git push --follow-tags
77
79
echo -e " Tags: ${BOLD_GREEN} $new_tag ${OFF} pushed to remote"
80
+
81
+ # Check if the latest major release tag and the new major release tag are the same
82
+ latest_major_tag=$( expr " $latest_tag " : " $major_tag_regex " )
83
+ new_major_tag=$( expr " $new_tag " : " $major_tag_regex " )
84
+
85
+ if [[ " $new_major_tag " = " $latest_major_tag " ]]; then
86
+ # This is a minor or patch release
87
+ # Point major release tag (e.g. v1, v2) to this release
88
+ git tag " $latest_major_tag " --force --annotate --message " Sync $latest_major_tag tag with $new_tag "
89
+ echo -e " Synced ${BOLD_GREEN} $latest_major_tag ${OFF} with ${BOLD_GREEN} $new_tag ${OFF} "
90
+ # Push major tag to remote
91
+ git push $git_remote " $latest_major_tag " --force
92
+ echo -e " Tags: ${BOLD_GREEN} $latest_major_tag ${OFF} pushed to remote"
93
+ fi
94
+
95
+ # Completed
78
96
echo -e " ${BOLD_GREEN} Done!${OFF} "
You can’t perform that action at this time.
0 commit comments