aboutsummaryrefslogtreecommitdiffstats
path: root/tools/maven-central/deploy.rb
blob: 2744e772a19b3e9de621afb19297483594420b24 (plain)
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
#!/usr/bin/env ruby
require 'rubygems'
require 'highline/import'

def run(args)
  system(*args)
end

def deploy_jar(artifact, version, prefix)
  pom = "#{artifact}-#{version}.pom"
  binary = "#{artifact}-#{version}.jar"
  javadoc = "#{artifact}-#{version}-javadoc.jar"
  sources = "#{artifact}-#{version}-sources.jar"

  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{binary}"]
  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{sources}",
                   "-Dclassifier=sources"]
  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{javadoc}",
                   "-Dclassifier=javadoc"]
end

def deploy_parent(version, prefix)
  pom = "org.eclipse.jgit-parent-#{version}.pom"
  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{pom}"]
end

def deploy_sh(artifact, version, prefix)
  pom = "#{artifact}-#{version}.pom"
  sh = "#{artifact}-#{version}.sh"
  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{sh}", "-Dpackaging=sh"]
end

def get_passphrase(prompt="Enter your GPG Passphrase")
   ask(prompt) {|q| q.echo = false}
end

version = ARGV[0].freeze
if version =~ /\A(\d+\.\d+\.\d+)\.(\d{12})-(m\d|rc\d|r)\Z/
   printf "version %s qualifier %s classifier %s\n", $1, $2, $3
else
   printf "invalid version %s\n", version
   abort
end

url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
repositoryId = 'sonatype-nexus-staging'
puts "gpg passphrase ?"
passphrase = get_passphrase()

group = 'org.eclipse.jgit'
artifacts = [group,
             group + '.ant',
             group + '.archive',
             group + '.http.apache',
             group + '.http.server',
             group + '.junit',
             group + '.junit.http',
             group + '.lfs',
             group + '.lfs.server',
             group + '.pgm',
             group + '.ui']

prefix = ["mvn", "gpg:sign-and-deploy-file", "-Dgpg.passphrase=#{passphrase}",
          "-Durl=#{url}", "-DrepositoryId=#{repositoryId}"]
deploy_parent(version, prefix)
artifacts.each do |artifact|
  deploy_jar(artifact, version, prefix)
end
deploy_sh('org.eclipse.jgit.pgm', version, prefix)