xref: /JGit/tools/maven-central/deploy.rb (revision f2bfaca08484b5547448640a01bf69f4f1176b17)
18de35128SMatthias Sohn#!/usr/bin/env ruby
28de35128SMatthias Sohnrequire 'rubygems'
38de35128SMatthias Sohnrequire 'highline/import'
48de35128SMatthias Sohn
58de35128SMatthias Sohndef run(args)
68de35128SMatthias Sohn  system(*args)
78de35128SMatthias Sohnend
88de35128SMatthias Sohn
98de35128SMatthias Sohndef deploy_jar(artifact, version, prefix)
108de35128SMatthias Sohn  pom = "#{artifact}-#{version}.pom"
118de35128SMatthias Sohn  binary = "#{artifact}-#{version}.jar"
128de35128SMatthias Sohn  javadoc = "#{artifact}-#{version}-javadoc.jar"
138de35128SMatthias Sohn  sources = "#{artifact}-#{version}-sources.jar"
148de35128SMatthias Sohn
158de35128SMatthias Sohn  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{binary}"]
168de35128SMatthias Sohn  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{sources}",
178de35128SMatthias Sohn                   "-Dclassifier=sources"]
188de35128SMatthias Sohn  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{javadoc}",
198de35128SMatthias Sohn                   "-Dclassifier=javadoc"]
208de35128SMatthias Sohnend
218de35128SMatthias Sohn
228de35128SMatthias Sohndef deploy_parent(version, prefix)
238de35128SMatthias Sohn  pom = "org.eclipse.jgit-parent-#{version}.pom"
248de35128SMatthias Sohn  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{pom}"]
258de35128SMatthias Sohnend
268de35128SMatthias Sohn
278de35128SMatthias Sohndef deploy_sh(artifact, version, prefix)
288de35128SMatthias Sohn  pom = "#{artifact}-#{version}.pom"
298de35128SMatthias Sohn  sh = "#{artifact}-#{version}.sh"
308de35128SMatthias Sohn  run prefix + ["-DpomFile=#{pom}", "-Dfile=#{sh}", "-Dpackaging=sh"]
318de35128SMatthias Sohnend
328de35128SMatthias Sohn
338de35128SMatthias Sohndef get_passphrase(prompt="Enter your GPG Passphrase")
348de35128SMatthias Sohn   ask(prompt) {|q| q.echo = false}
358de35128SMatthias Sohnend
368de35128SMatthias Sohn
37be25ecb3SMatthias Sohnversion = ARGV[0].freeze
38be25ecb3SMatthias Sohnif version =~ /\A(\d+\.\d+\.\d+)\.(\d{12})-(m\d|rc\d|r)\Z/
39be25ecb3SMatthias Sohn   printf "version %s qualifier %s classifier %s\n", $1, $2, $3
40be25ecb3SMatthias Sohnelse
41be25ecb3SMatthias Sohn   printf "invalid version %s\n", version
42be25ecb3SMatthias Sohn   abort
43be25ecb3SMatthias Sohnend
44be25ecb3SMatthias Sohn
458de35128SMatthias Sohnurl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
468de35128SMatthias SohnrepositoryId = 'sonatype-nexus-staging'
478de35128SMatthias Sohnputs "gpg passphrase ?"
488de35128SMatthias Sohnpassphrase = get_passphrase()
498de35128SMatthias Sohn
508de35128SMatthias Sohngroup = 'org.eclipse.jgit'
518de35128SMatthias Sohnartifacts = [group,
528de35128SMatthias Sohn             group + '.ant',
538de35128SMatthias Sohn             group + '.archive',
54*f2bfaca0SMatthias Sohn             group + '.gpg.bc',
55f59b680cSMatthias Sohn             group + '.http.apache',
568de35128SMatthias Sohn             group + '.http.server',
578de35128SMatthias Sohn             group + '.junit',
588de35128SMatthias Sohn             group + '.junit.http',
595218d2f5SMatthias Sohn             group + '.junit.ssh',
6024b6c080SMatthias Sohn             group + '.lfs',
6124b6c080SMatthias Sohn             group + '.lfs.server',
628de35128SMatthias Sohn             group + '.pgm',
635218d2f5SMatthias Sohn             group + '.ssh.apache',
64*f2bfaca0SMatthias Sohn             group + '.ssh.jsch',
658de35128SMatthias Sohn             group + '.ui']
668de35128SMatthias Sohn
678de35128SMatthias Sohnprefix = ["mvn", "gpg:sign-and-deploy-file", "-Dgpg.passphrase=#{passphrase}",
688de35128SMatthias Sohn          "-Durl=#{url}", "-DrepositoryId=#{repositoryId}"]
698de35128SMatthias Sohndeploy_parent(version, prefix)
708de35128SMatthias Sohnartifacts.each do |artifact|
718de35128SMatthias Sohn  deploy_jar(artifact, version, prefix)
728de35128SMatthias Sohnend
738de35128SMatthias Sohndeploy_sh('org.eclipse.jgit.pgm', version, prefix)
74