From a6e3169cfc5657e5819b3e018bf4c3cdf1c1377a Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 19 Jun 2019 14:40:39 +0300 Subject: [PATCH] Make possible to override the branch name via a env variable 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 | 1 + mix.exs | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97f96ffc8..fa5dafdb2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 781560a0a..ac25b7266 100644 --- 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)