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.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 + '.http.apache',
  46. group + '.http.server',
  47. group + '.java7',
  48. group + '.junit',
  49. group + '.junit.http',
  50. group + '.pgm',
  51. group + '.ui']
  52. prefix = ["mvn", "gpg:sign-and-deploy-file", "-Dgpg.passphrase=#{passphrase}",
  53. "-Durl=#{url}", "-DrepositoryId=#{repositoryId}"]
  54. deploy_parent(version, prefix)
  55. artifacts.each do |artifact|
  56. deploy_jar(artifact, version, prefix)
  57. end
  58. deploy_sh('org.eclipse.jgit.pgm', version, prefix)