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:
authorSarah German <sgerman@gitlab.com>2023-10-24 23:57:20 +0300
committerAchilleas Pipinellis <axil@gitlab.com>2023-10-24 23:57:20 +0300
commit6888e964c68771911f11707672d5d5e127d0f39a (patch)
tree712e69b722a18e1b6b935abdf9f6700f9063885c /lib
parent96d9b0c7e733d54f15a8b9694d9868afdfc0e537 (diff)
Refactor release task to use releases.yml
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/release.rake4
-rw-r--r--lib/tasks/task_helpers.rb15
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/tasks/release.rake b/lib/tasks/release.rake
index 30c69b6e..a323ea5c 100644
--- a/lib/tasks/release.rake
+++ b/lib/tasks/release.rake
@@ -57,9 +57,9 @@ namespace :release do
end
if DRY_RUN
- TaskHelpers.info("gitlab-docs", "DRY RUN: Not adding file #{dockerfile} to branch #{version} or commiting changes.")
+ TaskHelpers.info("gitlab-docs", "DRY RUN: Not adding file #{dockerfile} to branch #{version} or committing changes.")
else
- TaskHelpers.info("gitlab-docs", "Adding file #{dockerfile} and commiting changes to branch #{version}...")
+ TaskHelpers.info("gitlab-docs", "Adding file #{dockerfile} and committing changes to branch #{version}...")
`git add #{version}.Dockerfile`
`git commit -m 'Release cut #{version}'`
end
diff --git a/lib/tasks/task_helpers.rb b/lib/tasks/task_helpers.rb
index 7c33a3d3..6882d17e 100644
--- a/lib/tasks/task_helpers.rb
+++ b/lib/tasks/task_helpers.rb
@@ -3,14 +3,17 @@
require 'yaml'
require 'json'
require 'date'
+require 'nanoc'
+require_relative '../helpers/generic'
class TaskHelpers
+ include Nanoc::Helpers::Generic
+
PRODUCTS = %w[ee omnibus runner charts operator].freeze
VERSION_FORMAT = %r{^(?<major>\d{1,2})\.(?<minor>\d{1,2})$}.freeze
COLOR_CODE_RESET = "\e[0m"
COLOR_CODE_RED = "\e[31m"
COLOR_CODE_GREEN = "\e[32m"
- CURRENT_RELEASE_DATE = Date.today.strftime("%Y-%m-22")
def config
# Parse the config file and create a hash.
@@ -132,12 +135,12 @@ class TaskHelpers
puts "#{TaskHelpers::COLOR_CODE_GREEN}INFO: (#{slug}): #{message} #{TaskHelpers::COLOR_CODE_RESET}"
end
- def current_milestone
+ def current_milestone(release_date = Date.today.strftime("%Y-%m"))
@current_milestone ||= begin
- release_dates_json = File.read("#{project_root}/content/release_dates.json")
- # Search in the relase dates hash for the upcoming release date
- # and fetch the milestone title.
- JSON.parse(release_dates_json).first[CURRENT_RELEASE_DATE]
+ # Search in the relase dates hash for this month's release date
+ # and fetch the milestone version number.
+ releases = JSON.parse(get_release_dates)
+ releases.find { |item| item["date"].start_with?(release_date) }&.fetch("version", nil)
end
end
end