2
0

release 968 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. # Get the latest Git tag
  11. git fetch --force --tags
  12. latest_tag=$(git tag --sort=committerdate | grep -E '^github-v[0-9]+\.[0-9]+\.[0-9]+$' | tail -1)
  13. if [ -z "$latest_tag" ]; then
  14. echo "No tags found"
  15. exit 1
  16. fi
  17. echo "Latest tag: $latest_tag"
  18. # Split the tag into major, minor, and patch numbers
  19. IFS='.' read -ra VERSION <<< "$latest_tag"
  20. if [ "$minor" = true ]; then
  21. # Increment the minor version and reset patch to 0
  22. minor_number=${VERSION[1]}
  23. let "minor_number++"
  24. new_version="${VERSION[0]}.$minor_number.0"
  25. else
  26. # Increment the patch version
  27. patch_number=${VERSION[2]}
  28. let "patch_number++"
  29. new_version="${VERSION[0]}.${VERSION[1]}.$patch_number"
  30. fi
  31. echo "New version: $new_version"
  32. # Tag
  33. git tag $new_version
  34. git push --tags