I have a toolchain which builds my documentation of a project everytime when a new push arrives to my Git server.
When there is no specific version, the documentation should be build with the reference called "latest". But when I decice to set a version with the use of a Git tag, the tag should be used in the Git hook to build the documentation with this version number.
The pseudo-code of the hook should look like this:
if (tag_for_this_commit_exists):
build_docs(str(tag_of_this_commit))
else:
build_docs("latest")
Question 1:
How can i extract in the post-receive hook the information, if there is a tag assigned to the commit and if there was, which one?
Question 2:
How can I add the tag on the command line in a way that it belongs exactly to the push event and is pushed to the server together with the push of the software?