使用 Lua 编写的轻量文本编辑器。
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.

69 lines
1.4 KiB

  1. #!/usr/bin/env bash
  2. if [ ! -e "src/api/api.h" ]; then
  3. echo "Please run this script from the root directory of Lite XL."; exit 1
  4. fi
  5. show_help() {
  6. echo
  7. echo "Release notes generator for lite-xl releases."
  8. echo "USE IT AT YOUR OWN RISK!"
  9. echo
  10. echo "Usage: $0 <OPTIONS>"
  11. echo
  12. echo "Available options:"
  13. echo
  14. echo "--version The current version used to generate release notes."
  15. echo "--debug Debug this script."
  16. echo "--help Show this message."
  17. echo
  18. }
  19. main() {
  20. local version
  21. local last_version
  22. for i in "$@"; do
  23. case $i in
  24. --debug)
  25. set -x
  26. shift
  27. ;;
  28. --help)
  29. show_help
  30. exit 0
  31. ;;
  32. --version)
  33. version="$2"
  34. shift
  35. shift
  36. ;;
  37. *)
  38. # unknown option
  39. ;;
  40. esac
  41. done
  42. if [[ -n $1 ]]; then
  43. show_help
  44. exit 0
  45. fi
  46. if [[ -z "$version" ]]; then
  47. echo "error: a version must be provided"
  48. exit 1
  49. fi
  50. # use gh cli to get the last version
  51. read -r last_version < <(gh release list --exclude-pre-releases --limit 1 | awk 'BEGIN {FS="\t"}; {print $3}')
  52. if [[ -z "$last_version" ]]; then
  53. echo "error: cannot get last release git tag"
  54. exit 1
  55. fi
  56. export RELEASE_TAG="$version"
  57. export LAST_RELEASE_TAG="$last_version"
  58. envsubst '$RELEASE_TAG:$LAST_RELEASE_TAG' > release-notes.md < resources/release-notes.md
  59. }
  60. main "$@"