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.
 
 
 

54 lines
1.5 KiB

  1. #!/bin/bash
  2. set -ex
  3. VERSION=$(python -c "from wstools.version import __version__ ; print __version__")
  4. echo Preparing to release version $VERSION
  5. echo === Chechink that all changes are commited and pushed ===
  6. git pull
  7. git diff
  8. # Disallow unstaged changes in the working tree
  9. if ! git diff-files --check --exit-code --ignore-submodules -- >&2
  10. then
  11. echo >&2 "error: you have unstaged changes."
  12. #git diff-files --check --exit-code --ignore-submodules -- >&2
  13. exit 1
  14. fi
  15. # Disallow uncommitted changes in the index
  16. if ! git diff-index --cached --exit-code -r --ignore-submodules HEAD -- >&2
  17. then
  18. echo >&2 "error: your index contains uncommitted changes."
  19. exit 1
  20. fi
  21. git log --date=short --pretty=format:"%cd %s" > CHANGELOG
  22. git diff
  23. if [ -v PS1 ] ; then
  24. echo "Automatic deployment"
  25. else
  26. echo "Please don't run this as a user. This generates a new release for PyPI. Press ^C to exit or Enter to continue."
  27. read
  28. fi
  29. git add CHANGELOG
  30. git commit -a "Auto-generating release notes."
  31. git tag -f -a $VERSION -m "Version $VERSION"
  32. git tag -f -a RELEASE -m "Current RELEASE"
  33. NEW_VERSION="${VERSION%.*}.$((${VERSION##*.}+1))"
  34. set -ex
  35. sed -i ~ "s/${VERSION}/${NEW_VERSION}/" wstools/version.py
  36. git commit -a "Auto-increasing the version number after a release."
  37. # disables because this is done only by Travis CI from now, which calls this script after that.
  38. #python setup.py register sdist bdist_wheel build_sphinx upload_docs upload --sign
  39. git push --force origin --tags
  40. echo "done."