I want to automatically create a tag tag when git commit

  linux, question

For example, I want to create a tag tag when giving commit. It was later learned that the pre-committehook can be used.
Start editing shell scripts

#!  /bin/sh
 tag=$(git describe --tags `git rev-list --tags --max-count=1`)
 let "version+=1"
 echo 'Create New Tag '$newTag

The above is a shell script written by myself, which can automatically create tag tags when committing.
This also works normally only when tag is successfully created.
If tag creation fails, there is a problem.
I would like to ask what is the solution or better function of automatically creating tag tags.

I don’t know what the purpose of tag is when the host git submits, I usually use git emoji.
Git emoji