@@ -179,11 +179,19 @@ function release() {
179179
180180# @description Create a push and a new branch with commits previously prepared
181181# @exitcode 0 If successful.
182- # @exitcode 1 If an error is encountered when push the release .
182+ # @exitcode 1 If the last commit tag does not match the last git tag .
183183function release_push() {
184- local last_tag=" " branch_name=" "
185- # checkout released tag and creation of branch to push (becasue of main protection)
184+ local last_tag_prepare=" " last_tag=" " branch_name=" "
185+ # Check that the release has been properly prepared
186+ last_tag_prepare=$( git log -2 --pretty=%B| grep " prepare release" | awk ' {print $NF}' )
187+ # Retrieve last tag
186188 last_tag=$( git tag --sort=-version:refname | head -n 1)
189+ # Check that the tag is correct
190+ if ! [[ " $last_tag_prepare " = " $last_tag " ]]; then
191+ error " The last commit tag does not match the last git tag"
192+ return 1
193+ fi
194+ # Checkout released tag and creation of branch to push (because of main protection)
187195 branch_name=" release_${last_tag} "
188196 git checkout -b " ${branch_name} "
189197 # push branch associated to new tag release
@@ -242,7 +250,7 @@ function check_opts() {
242250 esac
243251 done
244252 # Help is displayed if no option is passed as script parameter
245- if [[ $(( HELP+ INIT+ START+ STOP+ CLEAN+ RELEASE+ BUILD+ COMPILE+ BUILD_DOCKER+ DISPLAY_LOGS)) -eq 0 ]]; then
253+ if [[ $(( HELP+ INIT+ START+ STOP+ CLEAN+ RELEASE+ RELEASE_PUSH + BUILD+ COMPILE+ BUILD_DOCKER+ DISPLAY_LOGS)) -eq 0 ]]; then
246254 HELP=1
247255 fi
248256 return 0
@@ -253,7 +261,7 @@ function execute_function() {
253261 if ! [[ $( type -t " ${ARGS[0]} " ) == function ]]; then
254262 error " Function with name ${ARGS[0]} does not exist" && return 1
255263 fi
256- eval " ${ARGS[@]} "
264+ " ${ARGS[@]} "
257265 return $?
258266}
259267
0 commit comments