draft-change-log-entries.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash -e
  2. version=$("$(dirname "$0")/get-version.sh")
  3. if [[ $version =~ ([0-9]+)\.([0-9]+)\.0 ]]; then
  4. major="${BASH_REMATCH[1]}"
  5. minor="${BASH_REMATCH[2]}"
  6. else
  7. echo "unexpected version: $version"
  8. exit 1
  9. fi
  10. if [[ $minor == 0 ]]; then
  11. prior_major=$((major - 1))
  12. prior_minor=$(sed -n "s/^## Version $prior_major\.\([0-9]\+\)\..*/\1/p" CHANGELOG.md | head -1)
  13. if [[ -z $prior_minor ]]; then
  14. # assuming this is the first release
  15. range=
  16. else
  17. range="v$prior_major.$prior_minor.0..HEAD"
  18. fi
  19. else
  20. range="v$major.$((minor - 1)).0..HEAD"
  21. fi
  22. echo "## Unreleased"
  23. echo
  24. echo "### Migration notes"
  25. echo
  26. echo
  27. echo "### 🌟 New javaagent instrumentation"
  28. echo
  29. echo
  30. echo "### 🌟 New library instrumentation"
  31. echo
  32. echo
  33. echo "### 📈 Enhancements"
  34. echo
  35. echo
  36. echo "### 🛠️ Bug fixes"
  37. echo
  38. echo
  39. echo "### 🧰 Tooling"
  40. echo
  41. git log --reverse --pretty=format:"- %s" "$range" \
  42. | sed -E 's,\(#([0-9]+)\)$,\n ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'