I have a Python webserver (using Bottle or Flask or any other) that I develop locally:
BUILDVERSION = "0.0.128"
@route('/')
def homepage():
... # using a template, and the homepage shows the BUILDVERSION in the footer
# so that I always know which live version is running
...
run(host='0.0.0.0', port=8080)
Each time I have a significant update, I do:
git commit -am "Commit name" && git push
and the distant version is updated. (Note: I use git config receive.denyCurrentBranch updateInstead on the distant repo).
Problem: I often forget to manually increment the BUILDVERSION on each commit, and then it's not easy to distinguish which version is running live, etc. (because two consecutive commits could have the same BUILDVERSION!)
Question: Is there a way to have an auto-incrementing BUILDVERSION on each commit with Python + Git? or anything similar (the BUILDVERSION could also be the commit ID...) that would be present in small characters in the footer of the website, allowing to distinguish consecutive versions of the Python code.
git log | head -1 | awk '{print $2}'do you get thecommit id?