xref: /JGit/tools/maven-central/deploy.rb (revision f2bfaca08484b5547448640a01bf69f4f1176b17)
1#!/usr/bin/env ruby
2require 'rubygems'
3require 'highline/import'
4
5def run(args)
6  system(*args)
7end
8
9def deploy_jar(artifact, version, prefix)
10  pom = "#{artifact}-#{version}.pom"
11  binary = "#{artifact}-#{version}.jar"
12  javadoc = "#{artifact}-#{version}-javadoc.jar"
13  sources = "#{artifact}-#{version}-sources.jar"
14
15  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{binary}"]
16  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{sources}",
17                   "-Dclassifier=sources"]
18  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{javadoc}",
19                   "-Dclassifier=javadoc"]
20end
21
22def deploy_parent(version, prefix)
23  pom = "org.eclipse.jgit-parent-#{version}.pom"
24  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{pom}"]
25end
26
27def deploy_sh(artifact, version, prefix)
28  pom = "#{artifact}-#{version}.pom"
29  sh = "#{artifact}-#{version}.sh"
30  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{sh}", "-Dpackaging=sh"]
31end
32
33def get_passphrase(prompt="Enter your GPG Passphrase")
34   ask(prompt) {|q| q.echo = false}
35end
36
37version = ARGV[0].freeze
38if version =~ /\A(\d+\.\d+\.\d+)\.(\d{12})-(m\d|rc\d|r)\Z/
39   printf "version %s qualifier %s classifier %s\n", $1, $2, $3
40else
41   printf "invalid version %s\n", version
42   abort
43end
44
45url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
46repositoryId = 'sonatype-nexus-staging'
47puts "gpg passphrase ?"
48passphrase = get_passphrase()
49
50group = 'org.eclipse.jgit'
51artifacts = [group,
52             group + '.ant',
53             group + '.archive',
54             group + '.gpg.bc',
55             group + '.http.apache',
56             group + '.http.server',
57             group + '.junit',
58             group + '.junit.http',
59             group + '.junit.ssh',
60             group + '.lfs',
61             group + '.lfs.server',
62             group + '.pgm',
63             group + '.ssh.apache',
64             group + '.ssh.jsch',
65             group + '.ui']
66
67prefix = ["mvn", "gpg:sign-and-deploy-file", "-Dgpg.passphrase=#{passphrase}",
68          "-Durl=#{url}", "-DrepositoryId=#{repositoryId}"]
69deploy_parent(version, prefix)
70artifacts.each do |artifact|
71  deploy_jar(artifact, version, prefix)
72end
73deploy_sh('org.eclipse.jgit.pgm', version, prefix)
74