forked from skywinder/ActionSheetPicker-3.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bump.rb
executable file
·34 lines (27 loc) · 831 Bytes
/
bump.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env ruby
readme = File.read("ActionSheetPicker-3.0.podspec")
re = /(\d+\.\d+\.)(\d+)/m
result = re.match(readme)
unless result
puts "Not found"
exit
end
pref = result[1]
new_version = result[2].to_i + 1
bumped_vers = pref + new_version.to_s
puts "Bump version: #{result} -> #{bumped_vers}"
def execute_line(line)
value =%x[#{line}]
puts value
if $?.exitstatus != 0
puts "Error -> terminate"
exit
end
end
execute_line("sed -i \"\" \"s/#{result}/#{bumped_vers}/\" README.md")
execute_line("sed -i \"\" \"s/#{result}/#{bumped_vers}/\" ActionSheetPicker-3.0.podspec")
execute_line("git commit --all -m \"Update podspec to version #{bumped_vers}\"")
execute_line("git tag #{bumped_vers}")
execute_line("git push")
execute_line("git push --tags")
execute_line("pod trunk push ./ActionSheetPicker-3.0.podspec")