Merge branch 'bugfix/mix.exs-version-dot-git-less' into 'develop'
mix.exs: version git-less (part 2, MacOS-compat) See merge request pleroma/pleroma!2420
This commit is contained in:
commit
6efd3730c3
1 changed files with 24 additions and 19 deletions
15
mix.exs
15
mix.exs
|
@ -230,14 +230,17 @@ defmodule Pleroma.Mixfile do
|
|||
defp version(version) do
|
||||
identifier_filter = ~r/[^0-9a-z\-]+/i
|
||||
|
||||
# Pre-release version, denoted from patch version with a hyphen
|
||||
{_cmdgit, cmdgit_err} = System.cmd("sh", ["-c", "command -v git"])
|
||||
|
||||
git_pre_release =
|
||||
if cmdgit_err == 0 do
|
||||
{tag, tag_err} =
|
||||
System.cmd("git", ["describe", "--tags", "--abbrev=0"], stderr_to_stdout: true)
|
||||
|
||||
{describe, describe_err} = System.cmd("git", ["describe", "--tags", "--abbrev=8"])
|
||||
{commit_hash, commit_hash_err} = System.cmd("git", ["rev-parse", "--short", "HEAD"])
|
||||
|
||||
git_pre_release =
|
||||
# Pre-release version, denoted from patch version with a hyphen
|
||||
cond do
|
||||
tag_err == 0 and describe_err == 0 ->
|
||||
describe
|
||||
|
@ -250,12 +253,14 @@ defmodule Pleroma.Mixfile do
|
|||
"0-g" <> String.trim(commit_hash)
|
||||
|
||||
true ->
|
||||
""
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
# Branch name as pre-release version component, denoted with a dot
|
||||
branch_name =
|
||||
with {branch_name, 0} <- System.cmd("git", ["rev-parse", "--abbrev-ref", "HEAD"]),
|
||||
with 0 <- cmdgit_err,
|
||||
{branch_name, 0} <- System.cmd("git", ["rev-parse", "--abbrev-ref", "HEAD"]),
|
||||
branch_name <- String.trim(branch_name),
|
||||
branch_name <- System.get_env("PLEROMA_BUILD_BRANCH") || branch_name,
|
||||
true <-
|
||||
|
@ -269,7 +274,7 @@ defmodule Pleroma.Mixfile do
|
|||
|
||||
branch_name
|
||||
else
|
||||
_ -> "stable"
|
||||
_ -> ""
|
||||
end
|
||||
|
||||
build_name =
|
||||
|
|
Loading…
Reference in a new issue