You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

deploy.rb 2.1KB

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