release.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. set -e
  3. # Don't start a release if the tree is dirty
  4. #
  5. if [[ ! -z $(git status -s) ]]; then
  6. echo "Git tree is not clean, aborting release!"
  7. exit 1
  8. fi
  9. # Get version and branch (we only do stable for now)
  10. #
  11. V="$1"
  12. RELEASE="${2:-stable}"
  13. if [[ -z $V ]]; then
  14. echo "A version must be specified!"
  15. exit 1
  16. fi
  17. VERSION="${RELEASE}-${V}"
  18. echo "Releasing ${VERSION}"
  19. if git rev-parse "${VERSION}" >/dev/null 2>&1; then
  20. echo "Tag for such version already exists!"
  21. exit 1
  22. fi
  23. # Prepare changelog
  24. #
  25. LAST_VERSION=$(git describe --tags --abbrev=0)
  26. CHANGES=$(git log --oneline --no-decorate --no-merges ${LAST_VERSION}..HEAD --pretty=format:"%x2a%x20%h%x20%s")
  27. echo "Changelog:"
  28. echo "$CHANGES"
  29. echo -e "## ${VERSION}\n\nBased on ${RELEASE} release ${V}.\n\n${CHANGES}\n" > tmp
  30. cat CHANGELOG.md >> tmp
  31. mv tmp CHANGELOG.md
  32. # Set specific image tags in compose files
  33. #
  34. sed -i "" -e "s/latest/${VERSION}/" *.yml
  35. # Commit all changes and tag the repo
  36. #
  37. git commit -a -m "release: ${VERSION}" -m "${CHANGES}"
  38. git tag -a "${VERSION}" -m "release" -m "${CHANGES}"
  39. # Tag Docker images and push them to DockerHub
  40. #
  41. JITSI_BUILD=${VERSION} make release
  42. # Revert back to "latest" for development
  43. #
  44. sed -i "" -e "s/${VERSION}/latest/" *.yml
  45. git commit -a -m "misc: working on latest"
  46. # Push all changes and tags
  47. #
  48. git push
  49. git push --tags