diff options
-rw-r--r-- | .gitlab/issue_templates/release.md | 10 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | doc/releases.md | 10 | ||||
-rw-r--r-- | lib/tasks/release.rake | 6 | ||||
-rw-r--r-- | lib/tasks/task_helpers.rb | 12 |
5 files changed, 28 insertions, 14 deletions
diff --git a/.gitlab/issue_templates/release.md b/.gitlab/issue_templates/release.md index 1c570826..48a8da37 100644 --- a/.gitlab/issue_templates/release.md +++ b/.gitlab/issue_templates/release.md @@ -30,15 +30,15 @@ Prerequisites: make update ``` - 1. [ ] Run the Rake task to create the single version. For example, to create the 15.0 release branch - and perform other tasks: + 1. [ ] Create the stable branch: ```shell - ./bin/rake "release:single[15.0]" + make create-stable-branch ``` - A branch for the release is created, a new `15.0.Dockerfile` is created and - automatically committed, and the new branch is pushed. + - A branch `X.Y` for the release is created. + - A new `X.Y.Dockerfile` is created and automatically committed. + - The new branch is pushed. After the branch is created, the [`image:docs-single` job](https://gitlab.com/gitlab-org/gitlab-docs/-/blob/7fbb5e1313ebde811877044e87f444a0a283fed4/.gitlab/ci/docker-images.gitlab-ci.yml#L107-129) @@ -214,4 +214,8 @@ add-gitlab-fonts: cp -v node_modules/@gitlab/fonts/gitlab-sans/GitLabSans.woff2 public/assets/fonts cp -v node_modules/@gitlab/fonts/jetbrains-mono/JetBrainsMono* public/assets/fonts +create-stable-branch: + @printf "\n$(INFO)INFO: Creating stable branch...$(END)\n" + @bundle exec rake release:single + test: setup rspec-tests jest-tests eslint-tests prettier-tests stylelint-tests hadolint-tests yamllint-tests markdownlint-tests check-global-navigation diff --git a/doc/releases.md b/doc/releases.md index 5b4d808c..94b41b7e 100644 --- a/doc/releases.md +++ b/doc/releases.md @@ -68,19 +68,19 @@ To create a stable branch of the `gitlab-docs` project and a Docker image for th make update ``` -1. Optional. To practice running the task and check the process, run the Rake task in dry run mode. For example, to check the process for the 15.0 release: +1. Optional. To practice running the task and check the process, run the Rake task in dry run mode: ```shell - DRY_RUN=true ./bin/rake "release:single[15.0]" + DRY_RUN=true make create-stable-branch ``` -1. Run the Rake task to create the single version. For example, to create the 15.0 release: +1. Run the make target to create the stable branch: ```shell - ./bin/rake "release:single[15.0]" + make create-stable-branch ``` - A branch for the release is created, a new `15.0.Dockerfile` is created and + A branch for the release is created, a new `X.Y.Dockerfile` is created and automatically committed, and the new branch is pushed. After the branch is created, the diff --git a/lib/tasks/release.rake b/lib/tasks/release.rake index ea46f0fe..30c69b6e 100644 --- a/lib/tasks/release.rake +++ b/lib/tasks/release.rake @@ -9,16 +9,14 @@ DRY_RUN = ENV['DRY_RUN'] == 'true' namespace :release do desc 'Creates a single release archive' - task :single, :version do |_t, args| + task :single, :version do require "highline/import" - version = args.version.to_s + version = task_helpers.current_milestone # Disable lefthook because it causes PATH errors # https://docs.gitlab.com/ee/development/contributing/style_guides.html#disable-lefthook-temporarily ENV['LEFTHOOK'] = '0' - raise 'You need to specify a version, like 10.1' unless version.match?(%r{\A\d+\.\d+\z}) - abort("\n#{TaskHelpers::COLOR_CODE_RED}ERROR: Rake aborted! Local branch already exists. Run `git branch --delete --force #{version}` and rerun the task.#{TaskHelpers::COLOR_CODE_RESET}") \ if task_helpers.local_branch_exist?(version) diff --git a/lib/tasks/task_helpers.rb b/lib/tasks/task_helpers.rb index 106a29f3..7c33a3d3 100644 --- a/lib/tasks/task_helpers.rb +++ b/lib/tasks/task_helpers.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true require 'yaml' +require 'json' +require 'date' class TaskHelpers PRODUCTS = %w[ee omnibus runner charts operator].freeze @@ -8,6 +10,7 @@ class TaskHelpers 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. @@ -128,4 +131,13 @@ class TaskHelpers def self.info(slug, message) puts "#{TaskHelpers::COLOR_CODE_GREEN}INFO: (#{slug}): #{message} #{TaskHelpers::COLOR_CODE_RESET}" end + + def current_milestone + @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] + end + end end |