I have the following mix.exs
defmodule App.MixProject do
use Mix.Project
@version "0.1.0"
def git_ref(), do: System.get_git_hash()
def project do
[
app: :app,
version: @version,
...
releases: [
app: fn ->
[version: @version <> "+" <> git_ref()]
end
]
]
end
end
I would like to output the release version in my app. I have seen this question, Access project version within elixir application but all the answers return "0.1.0", i.e the "project.version"
If I run my release with _build/../app version
, it returns the correct value, so it is able to get the git hash and set the key value, but that value is written out to a file for the version
command.
I just don't know how to get it "at runtime". Is this possible? I thought the version may overwrite the previous key value, but I guess they are distinct?
@version "0.1.0" <> System.get_git_hash()
? ā Aleksei Matiushkin@version
as I showed above. ā Aleksei Matiushkin