Skip to content

Commit

Permalink
[CI] Updates bump version task
Browse files Browse the repository at this point in the history
The release manager is going to call `make.sh bump VERSION` from a specific branch.
  • Loading branch information
picandocodigo committed Jan 24, 2022
1 parent a8f9698 commit 480433e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions .ci/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ if [[ "$CMD" == "assemble" ]]; then
fi
fi

if [[ "$CMD" == "bump" ]]; then
echo "TODO"
fi

if [[ "$CMD" == "codegen" ]]; then
echo "TODO"
fi
Expand Down
8 changes: 4 additions & 4 deletions rake_tasks/unified_release_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,24 @@ namespace :unified_release do
$ rake unified_release:bump[42.0.0]
DESC
task :bump, :version do |_, args|
abort('[!] Required argument [version] missing') unless args[:version]
abort('[!] Required argument [version] missing') unless (version = args[:version])

files = ['elasticsearch/elasticsearch.gemspec']
RELEASE_TOGETHER.each do |gem|
files << Dir["./#{gem}/**/**/version.rb"]
end

version_regexp = Regexp.new(/VERSION = ("|'([0-9.]+(-SNAPSHOT)?)'|")/)
gemspec_regexp = Regexp.new(/('elasticsearch-transport'|'elasticsearch-api'),\s+'([0-9.]+)'/)
gemspec_regexp = Regexp.new(/('elasticsearch-transport'|'elasticsearch-api'),\s+'([0-9x.]+)'/)

files.flatten.each do |file|
content = File.read(file)
regexp = file.match?('gemspec') ? gemspec_regexp : version_regexp

if (match = content.match(regexp))
old_version = match[2]
content.gsub!(old_version, args[:version])
puts "[#{old_version}] -> [#{args[:version]}] in #{file.gsub('./','')}"
content.gsub!(old_version, version)
puts "[#{old_version}] -> [#{version}] in #{file.gsub('./','')}"
File.open(file, 'w') { |f| f.puts content }
else
puts "- [#{file}]".ljust(longest_line+20) + " -"
Expand Down

0 comments on commit 480433e

Please sign in to comment.