Add PLEROMA_BUILD_ENV to override env for the version generator and use it in the...
authorrinpatch <rinpatch@sdf.org>
Sat, 29 Jun 2019 11:25:47 +0000 (14:25 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 29 Jun 2019 11:28:26 +0000 (14:28 +0300)
This is needed because if we run with MIX_ENV=dev we will get a "+dev"
suffix to the version in the docs, but if we run with MIX_ENV=prod the
docs build will fail because ex_doc is dev-only dependency.

.gitlab-ci.yml
mix.exs

index f8711f299e032b8ce6b3a6f386e0a1772d388043..d0c540b16f7ebcb5fd648ab1a60aa6d962a75098 100644 (file)
@@ -35,6 +35,7 @@ docs-build:
   - develop@pleroma/pleroma
   variables:
     MIX_ENV: dev
+    PLEROMA_BUILD_ENV: prod
   script:
     - mix deps.get
     - mix compile
diff --git a/mix.exs b/mix.exs
index 19a80ffb205a2e68e35442b82eb0474f88dd6c1b..c2618d2b2c6ddfc70d6155a69c2de088c0087f33 100644 (file)
--- a/mix.exs
+++ b/mix.exs
@@ -207,6 +207,15 @@ defmodule Pleroma.Mixfile do
 
     env_name = if Mix.env() != :prod, do: to_string(Mix.env())
 
+    env_override = System.get_env("PLEROMA_BUILD_ENV")
+
+    env_name =
+      if env_override do
+        if env_override != "prod", do: env_override
+      else
+        env_name
+      end
+
     build =
       [build_name, env_name]
       |> Enum.filter(fn string -> string && string != "" end)