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
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2021-01-13 11:00:03 +0300
committerMarcel Amirault <mamirault@gitlab.com>2021-01-13 11:00:03 +0300
commit28df6ddadb0bf57ab251b5c86093c0f1e9d06596 (patch)
tree7952e38c9ea764256ed7734b990c6d40df895e96 /lib/helpers/generic.rb
parenta75621454ed1df6425afa7ff7a08d44b350e92a6 (diff)
Add helper for production and default branch
This ought to be used when we don't want to deploy things in the stable branches, since they are considered production.
Diffstat (limited to 'lib/helpers/generic.rb')
-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