Skip to content

Instantly share code, notes, and snippets.

@dougo-chris
Created September 10, 2019 21:54
Show Gist options
  • Save dougo-chris/f358b42ea1dd5a5497a7e893fd276e55 to your computer and use it in GitHub Desktop.
Save dougo-chris/f358b42ea1dd5a5497a7e893fd276e55 to your computer and use it in GitHub Desktop.
Updating Elixir Versions with git sha
defmodule MyApp.App.Mixfile do
use Mix.Project
def project do
[
app: :my_app,
version: "0.0.1-#{sha()}",
...
def sha do
case System.cmd("git", ["rev-parse", "HEAD"]) do
{tag, 0} ->
String.trim(tag)
_ ->
"UNKNOWN"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment