diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2020-08-22 10:17:19 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2020-08-22 10:17:19 +0300 |
commit | 0c49509fa7468112e77c48745bd9f4f57dcc3a63 (patch) | |
tree | e52b82fcbafa1f4ebcc00b2a834d735a1ab81ba0 /Rakefile | |
parent | 57448091ce891154110ad51e418a82b26eb3921a (diff) |
Checkout the release branch automatically for versions raketask
Previously, we instructed the users to change to the release branch
themselves before running the versions dropdown raketask.
With this change, this now happens automatically, thus eliminating
a manual step of the process.
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -121,7 +121,7 @@ namespace :release do abort("Rake aborted! The branch already exists. Delete it with `git branch -D #{version}` and rerun the task.") end - # Stash modified and untracked files so we have "clean" environment + # Stash modified and untracked files so we have a "clean" environment # without accidentally deleting data puts "Stashing changes" `git stash -u` if git_workdir_dirty? @@ -180,13 +180,22 @@ namespace :release do desc 'Creates merge requests to update the dropdowns in all online versions' task :dropdowns do - # Check if you're on master branch before starting. Fail if you are. - if `git branch --show-current`.tr("\n",'') == 'master' + # Check if a release branch has been created and warn the user if it hasn't + if `git rev-parse --verify #{release_branch}`.empty? abort(' - It appears you are on master branch. Create the current release - branch and run the raketask again. Follow the documentation guide - on how to create it: https://docs.gitlab.com/ee/development/documentation/site_architecture/versions.html#3-create-the-release-merge-request + A release branch for the latest stable version has not been created. + Follow the documentation guide on how to create one: + https://docs.gitlab.com/ee/development/documentation/site_architecture/versions.html#3-create-the-release-merge-request ') + else + # Stash modified and untracked files so we have a "clean" environment + # without accidentally deleting data + puts "Stashing changes" + `git stash -u` if git_workdir_dirty? + + # Change to the release branch and sync with upstream + `git checkout #{release_branch}` + `git pull #{release_branch}` end # Load online versions @@ -198,15 +207,6 @@ namespace :release do # The release branch name release_branch = "release-#{current_version.tr('.', '-')}" - # Check if a release branch has been created, if not fail and warn the user - if `git rev-parse --verify #{release_branch}`.empty? - abort(' - A release branch for the latest stable version has not been created. - Follow the documentation guide on how to create one: - https://docs.gitlab.com/ee/development/documentation/site_architecture/versions.html#3-create-the-release-merge-request - ') - end - # Set the commit title commit_title = "Update dropdown to #{current_version}" |