Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarcel Amirault <mamirault@gitlab.com>2021-01-13 11:00:03 +0300
committerMarcel Amirault <mamirault@gitlab.com>2021-01-13 11:00:03 +0300
commit22fd7bd39d588725de29121dd196cd3fdc4ee3b8 (patch)
tree1df743321f250171cba9caa35b99170af625f340 /lib
parent9c9fe3a3c7934e7681bf30d39f7bd139233fe9f7 (diff)
parent28df6ddadb0bf57ab251b5c86093c0f1e9d06596 (diff)
Merge branch 'helper-prod-default-branch' into 'master'
Add helper for production and default branch See merge request gitlab-org/gitlab-docs!1422
Diffstat (limited to 'lib')
-rw-r--r--lib/helpers/generic.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/helpers/generic.rb b/lib/helpers/generic.rb
index 09c03e80..6dfcaf96 100644
--- a/lib/helpers/generic.rb
+++ b/lib/helpers/generic.rb
@@ -9,6 +9,19 @@ module Nanoc::Helpers
ENV['NANOC_ENV'] == 'production'
end
+ #
+ # Check if NANOC_ENV is set to production and the branch is the default one.
+ # For things that should only be built in production of the default branch.
+ # Sometimes we don't want things to be deployed into the stable branches,
+ # which they are considered production.
+ #
+ def production_and_default_branch?
+ ENV['NANOC_ENV'] == 'production' and ENV['CI_DEFAULT_BRANCH'] == ENV['CI_COMMIT_BRANCH']
+ end
+
+ #
+ # Used when bundling gitlab-docs with Omnibus
+ #
def omnibus?
ENV['NANOC_ENV'] == 'omnibus'
end