I would like to automatically inject a git-based (e.g., tag + commit) version identifier (for example, under resources/version.edn) when building a jar, so I can use it e.g., when logging.
I know there are some lein plugins (e.g, lein-v) that can do something like this, but I haven’t found any tools.deps equivalents. I guess it’d be easy enough to hack something together that does this, but if there’s an existing solution, I’d be happy to adopt it.
Thanks! I’ll have a lookg at this, it seems to do pretty much what I need.
In the meantime, I came up with a short bash script that does something similar to what @dimovich does, and run that on a post-commit hook, generating a .gitignored version file.
And this is called by a post-commit hook, with output redirected to resources/version.edn (which is not under version control, otherwise you always get a dirty repo)