tag-release 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/sh
  2. version=""
  3. repo=""
  4. branch=""
  5. push=0
  6. for opt; do
  7. case "$opt" in
  8. --ver=*)
  9. version=`echo $opt | sed 's/[-a-zA-Z0-9]*=//'`
  10. ;;
  11. --repo=*)
  12. repo=`echo $opt | sed 's/[-a-zA-Z0-9]*=//'`
  13. ;;
  14. --branch=*)
  15. branch=`echo $opt | sed 's/[-a-zA-Z0-9]*=//'`
  16. ;;
  17. --push)
  18. push=1
  19. ;;
  20. --no-push)
  21. push=0
  22. ;;
  23. -*)
  24. echo "Invalid option: $opt" 1>&2
  25. exit 1
  26. ;;
  27. *)
  28. version=$opt
  29. ;;
  30. esac
  31. done
  32. if [ -z "$version" ]; then
  33. echo " Usage"
  34. echo " $0 --ver=num [--repo=name --branch=name --push]" 1>&2
  35. echo " Example"
  36. echo " $0 --ver=2.10rc1 --repo=git+ssh://user@repo.or.cz/nasm.git --branch=master --no-push" 1>&2
  37. echo " With --no-push the changes are not pushed out to remote repo"
  38. exit 1
  39. fi
  40. tag="nasm-$version"
  41. echo "$version" > version
  42. git add version
  43. git commit -m "NASM $version"
  44. git tag -a -m "NASM $version" "$tag"
  45. if [ $push = 1 ]; then
  46. set -x
  47. git push $repo $branch
  48. git push $repo $tag
  49. git push --tags $repo
  50. set +x
  51. fi