.releasinator.rb 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #### releasinator config ####
  2. configatron.product_name = "PayPal node SDK"
  3. # List of items to confirm from the person releasing. Required, but empty list is ok.
  4. configatron.prerelease_checklist_items = [
  5. "Sanity check the master branch.",
  6. "Unit tests passed."
  7. ]
  8. def validate_version_match()
  9. if 'v'+package_version() != @current_release.version
  10. Printer.fail("Package.json version #{package_version} does not match changelog version #{@current_release.version}.")
  11. abort()
  12. end
  13. Printer.success("Package.json version #{package_version} matches latest changelog version #{@current_release.version}.")
  14. end
  15. def validate_paths
  16. @validator.validate_in_path("grunt")
  17. @validator.validate_in_path("npm")
  18. @validator.validate_in_path("jq")
  19. end
  20. configatron.custom_validation_methods = [
  21. method(:validate_paths),
  22. method(:validate_version_match)
  23. ]
  24. def build_method
  25. CommandProcessor.command("npm test", live_output=true)
  26. end
  27. # The command that builds the sdk. Required.
  28. configatron.build_method = method(:build_method)
  29. def publish_to_package_manager(version)
  30. CommandProcessor.command("npm publish .")
  31. end
  32. # The method that publishes the sdk to the package manager. Required.
  33. configatron.publish_to_package_manager_method = method(:publish_to_package_manager)
  34. def wait_for_package_manager(version)
  35. CommandProcessor.wait_for("wget -U \"non-empty-user-agent\" -qO- https://registry.npmjs.org/paypal-rest-sdk | jq '.[\"dist-tags\"][\"latest\"]' | grep #{package_version} | cat")
  36. end
  37. # The method that waits for the package manager to be done. Required
  38. configatron.wait_for_package_manager_method = method(:wait_for_package_manager)
  39. # Whether to publish the root repo to GitHub. Required.
  40. configatron.release_to_github = true
  41. def package_version()
  42. File.open("Package.json", 'r') do |f|
  43. f.each_line do |line|
  44. if line.match (/\"version\": \"\d*\.\d*\.\d*\"/)
  45. return line.strip.split(':')[1].strip.split('"')[1]
  46. end
  47. end
  48. end
  49. end