release 976 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env bash
  2. # Parse command line arguments
  3. minor=false
  4. while [ "$#" -gt 0 ]; do
  5. case "$1" in
  6. --minor) minor=true; shift 1;;
  7. *) echo "Unknown parameter: $1"; exit 1;;
  8. esac
  9. done
  10. git fetch --force --tags
  11. # Get the latest Git tag
  12. latest_tag=$(git tag --sort=committerdate | grep -E '[0-9]' | tail -1)
  13. # If there is no tag, exit the script
  14. if [ -z "$latest_tag" ]; then
  15. echo "No tags found"
  16. exit 1
  17. fi
  18. echo "Latest tag: $latest_tag"
  19. # Split the tag into major, minor, and patch numbers
  20. IFS='.' read -ra VERSION <<< "$latest_tag"
  21. if [ "$minor" = true ]; then
  22. # Increment the minor version and reset patch to 0
  23. minor_number=${VERSION[1]}
  24. let "minor_number++"
  25. new_version="${VERSION[0]}.$minor_number.0"
  26. else
  27. # Increment the patch version
  28. patch_number=${VERSION[2]}
  29. let "patch_number++"
  30. new_version="${VERSION[0]}.${VERSION[1]}.$patch_number"
  31. fi
  32. echo "New version: $new_version"
  33. git tag $new_version
  34. git push --tags