Merge branch 'fix/991-version-generation' into 'develop'
version generation Closes #991 See merge request pleroma/pleroma!1291
This commit is contained in:
commit
57d54a9f09
1 changed files with 14 additions and 2 deletions
16
mix.exs
16
mix.exs
|
@ -176,7 +176,9 @@ defmodule Pleroma.Mixfile do
|
||||||
ahead <- String.replace(describe, tag, "") do
|
ahead <- String.replace(describe, tag, "") do
|
||||||
{String.replace_prefix(tag, "v", ""), if(ahead != "", do: String.trim(ahead))}
|
{String.replace_prefix(tag, "v", ""), if(ahead != "", do: String.trim(ahead))}
|
||||||
else
|
else
|
||||||
_ -> {nil, nil}
|
_ ->
|
||||||
|
{commit_hash, 0} = System.cmd("git", ["rev-parse", "--short", "HEAD"])
|
||||||
|
{nil, "-0-g" <> String.trim(commit_hash)}
|
||||||
end
|
end
|
||||||
|
|
||||||
if git_tag && version != git_tag do
|
if git_tag && version != git_tag do
|
||||||
|
@ -203,7 +205,17 @@ defmodule Pleroma.Mixfile do
|
||||||
string -> "+" <> string
|
string -> "+" <> string
|
||||||
end).()
|
end).()
|
||||||
|
|
||||||
[version, git_pre_release, build]
|
branch_name =
|
||||||
|
with {branch_name, 0} <- System.cmd("git", ["rev-parse", "--abbrev-ref", "HEAD"]),
|
||||||
|
true <- branch_name != "master" do
|
||||||
|
branch_name =
|
||||||
|
String.trim(branch_name)
|
||||||
|
|> String.replace(~r/\W+/, "-")
|
||||||
|
|
||||||
|
"-" <> branch_name
|
||||||
|
end
|
||||||
|
|
||||||
|
[version, git_pre_release, branch_name, build]
|
||||||
|> Enum.filter(fn string -> string && string != "" end)
|
|> Enum.filter(fn string -> string && string != "" end)
|
||||||
|> Enum.join()
|
|> Enum.join()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue