Fix semver parsing, add "+soapbox" to instance version

This commit is contained in:
Alex Gleason 2022-04-27 12:47:21 -05:00
parent 9e66daf60a
commit b8dd4c7e3e
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

18
mix.exs
View file

@ -1,6 +1,8 @@
defmodule Pleroma.Mixfile do defmodule Pleroma.Mixfile do
use Mix.Project use Mix.Project
@build_name "soapbox"
def project do def project do
[ [
app: :pleroma, app: :pleroma,
@ -281,21 +283,15 @@ defp version(version) do
!Enum.any?(["master", "HEAD", "release/", "stable"], fn name -> !Enum.any?(["master", "HEAD", "release/", "stable"], fn name ->
String.starts_with?(name, branch_name) String.starts_with?(name, branch_name)
end) do end) do
branch_name = String.trim(branch_name)
branch_name
|> String.trim()
|> String.replace(identifier_filter, "-")
branch_name
else else
_ -> "" _ -> ""
end end
build_name = build_name =
cond do cond do
name = Application.get_env(:pleroma, :build_name) -> name
name = System.get_env("PLEROMA_BUILD_NAME") -> name name = System.get_env("PLEROMA_BUILD_NAME") -> name
true -> nil true -> @build_name
end end
env_name = if Mix.env() != :prod, do: to_string(Mix.env()) env_name = if Mix.env() != :prod, do: to_string(Mix.env())
@ -312,21 +308,23 @@ defp version(version) do
# and a series of dot separated identifiers # and a series of dot separated identifiers
pre_release = pre_release =
[git_pre_release, branch_name] [git_pre_release, branch_name]
|> Enum.map(&String.replace(&1, identifier_filter, "-"))
|> Enum.filter(fn string -> string && string != "" end) |> Enum.filter(fn string -> string && string != "" end)
|> Enum.join(".") |> Enum.join(".")
|> (fn |> (fn
"" -> nil "" -> nil
string -> "-" <> String.replace(string, identifier_filter, "-") string -> "-" <> string
end).() end).()
# Build metadata, denoted with a plus sign # Build metadata, denoted with a plus sign
build_metadata = build_metadata =
[build_name, env_name] [build_name, env_name]
|> Enum.map(&String.replace(&1, identifier_filter, "-"))
|> Enum.filter(fn string -> string && string != "" end) |> Enum.filter(fn string -> string && string != "" end)
|> Enum.join(".") |> Enum.join(".")
|> (fn |> (fn
"" -> nil "" -> nil
string -> "+" <> String.replace(string, identifier_filter, "-") string -> "+" <> string
end).() end).()
[version, pre_release, build_metadata] [version, pre_release, build_metadata]