geoip redirection for superforex.com.au
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.

61 lines
947B

  1. #!/bin/bash
  2. set -eu -o pipefail
  3. changelog=$(cat CHANGELOG.md)
  4. regex='
  5. ([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\)
  6. -*
  7. ((.|
  8. )*)
  9. '
  10. if [[ ! $changelog =~ $regex ]]; then
  11. echo "Could not find date line in change log!"
  12. exit 1
  13. fi
  14. version="${BASH_REMATCH[1]}"
  15. date="${BASH_REMATCH[2]}"
  16. notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^[0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')"
  17. if [[ "$date" != $(date +"%Y-%m-%d") ]]; then
  18. echo "$date is not today!"
  19. exit 1
  20. fi
  21. tag="v$version"
  22. if [ -n "$(git status --porcelain)" ]; then
  23. echo ". is not clean." >&2
  24. exit 1
  25. fi
  26. php composer.phar self-update
  27. php composer.phar update
  28. ./vendor/bin/phpunit
  29. echo "Release notes for $tag:"
  30. echo "$notes"
  31. read -e -p "Commit changes and push to origin? " should_push
  32. if [ "$should_push" != "y" ]; then
  33. echo "Aborting"
  34. exit 1
  35. fi
  36. git push
  37. message="$version
  38. $notes"
  39. hub release create -m "$message" "$tag"
  40. git push --tags