-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy path.releasinator.rb
71 lines (55 loc) · 2.1 KB
/
.releasinator.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
task :default => :test
configatron.product_name = "PayPalHttp Java"
# Custom validations
def package_version
File.open("build.gradle", 'r') do |f|
f.each_line do |line|
if line.match (/version \'\d+.\d+.\d+'/)
return line.strip.split('\'')[1]
end
end
end
end
def validate_version_match
if package_version != @current_release.version
Printer.fail("package version #{package_version} does not match changelog version #{@current_release.version}.")
abort()
end
Printer.success("package version #{package_version} matches latest changelog version #{@current_release.version}.")
end
def test
CommandProcessor.command("./gradlew clean build test")
end
configatron.custom_validation_methods = [
method(:validate_version_match),
method(:test)
]
# Update version, build, and publish to Maven
def update_version_method(version, semver_type)
contents = File.read("build.gradle")
contents = contents.gsub(/version '\d+.\d+.\d+'/, "version '#{version}'")
File.open("build.gradle", "w") do |file|
file.puts contents
end
end
configatron.update_version_method = method(:update_version_method)
def build
CommandProcessor.command("./gradlew clean build")
end
configatron.build_method = method(:build)
def publish_to_package_manager(version)
CommandProcessor.command("./gradlew paypalhttp:uploadArchives", live_output=true)
CommandProcessor.command("./gradlew paypalhttp:closeAndReleaseRepository", live_output=true)
puts
sleep 60
CommandProcessor.command("./gradlew paypalhttp-testutils:uploadArchives", live_output=true)
CommandProcessor.command("./gradlew paypalhttp-testutils:closeAndReleaseRepository", live_output=true)
end
configatron.publish_to_package_manager_method = method(:publish_to_package_manager)
def wait_for_package_manager(version)
CommandProcessor.wait_for("wget -U \"non-empty-user-agent\" -qO- http://central.maven.org/maven2/com/paypal/paypalhttp/#{version}/paypalhttp-#{version}.pom | cat")
end
configatron.wait_for_package_manager_method = method(:wait_for_package_manager)
# Miscellania
configatron.release_to_github = true
configatron.prerelease_checklist_items = []