Make possible to override the branch name via a env variable
authorrinpatch <rinpatch@sdf.org>
Wed, 19 Jun 2019 11:40:39 +0000 (14:40 +0300)
committerrinpatch <rinpatch@sdf.org>
Wed, 19 Jun 2019 11:40:39 +0000 (14:40 +0300)
This is useful for the CI builds because they have a detached HEAD or
for emulating a feature that is availible only on a particular branch
(e.g pleroma_ctl downloads CI artifacts only for develop and master)

.gitlab-ci.yml
mix.exs

index 97f96ffc833883e4890fe55ef8602acb68ae3086..fa5dafdb21f38f0a2ad54891aec075ec92682723 100644 (file)
@@ -173,6 +173,7 @@ amd64:
   script: &release
     - mix deps.get --only prod
     - mkdir release
+    - PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
     - mix release --path release
 
 
diff --git a/mix.exs b/mix.exs
index 781560a0a2b4f9097e6824403b8b222c60c08fe8..ac25b726667b548cdf456ddcd7c513e74f6a312c 100644 (file)
--- a/mix.exs
+++ b/mix.exs
@@ -207,6 +207,7 @@ defmodule Pleroma.Mixfile do
 
     branch_name =
       with {branch_name, 0} <- System.cmd("git", ["rev-parse", "--abbrev-ref", "HEAD"]),
+           branch_name <- System.get_env("PLEROMA_BUILD_BRANCH") || branch_name,
            true <- branch_name != "master" do
         branch_name =
           String.trim(branch_name)