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 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 = '3.3.0.201403021825-r'.freeze
  31. url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
  32. repositoryId = 'sonatype-nexus-staging'
  33. puts "gpg passphrase ?"
  34. passphrase = get_passphrase()
  35. group = 'org.eclipse.jgit'
  36. artifacts = [group,
  37. group + '.ant',
  38. group + '.archive',
  39. group + '.console',
  40. group + '.http.apache',
  41. group + '.http.server',
  42. group + '.java7',
  43. group + '.junit',
  44. group + '.junit.http',
  45. group + '.pgm',
  46. group + '.ui']
  47. prefix = ["mvn", "gpg:sign-and-deploy-file", "-Dgpg.passphrase=#{passphrase}",
  48. "-Durl=#{url}", "-DrepositoryId=#{repositoryId}"]
  49. deploy_parent(version, prefix)
  50. artifacts.each do |artifact|
  51. deploy_jar(artifact, version, prefix)
  52. end
  53. deploy_sh('org.eclipse.jgit.pgm', version, prefix)