title: Get elixir mix release version in application
body: <p>I have the following mix.exs</p>
  <pre><code>defmodule App.MixProject do
    use Mix.Project
  
    @version &quot;0.1.0&quot;
    def git_ref(), do: System.get_git_hash()
  
    def project do
      [
        app: :app,
        version: @version,
        ...
        releases: [
          app: fn -&gt;
            [version: @version &lt;&gt; &quot;+&quot; &lt;&gt; git_ref()]
          end
        ]
      ]
    end
  end
  </code></pre>
  <p>I would like to output the <em>release</em> version in my app. I have seen this question, <a href="https://stackoverflow.com/questions/32968253/access-project-version-within-elixir-application">Access project version within elixir application</a> but all the answers return &quot;0.1.0&quot;, i.e the &quot;project.version&quot;</p>
  <p>If I run my release with <code>_build/../app version</code>, 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 <code>version</code> command.</p>
  <p>I just don't know how to get it &quot;at runtime&quot;. Is this possible? I thought the version may overwrite the previous key value, but I guess they are distinct?</p>