release.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. # Tag Docker images and push them to DockerHub
  30. #
  31. JITSI_BUILD=${VERSION} JITSI_RELEASE=${RELEASE} make release
  32. # Changelog
  33. #
  34. echo -e "## ${VERSION}\n\nBased on ${RELEASE} release ${V}.\n\n${CHANGES}\n" > tmp
  35. cat CHANGELOG.md >> tmp
  36. mv tmp CHANGELOG.md
  37. # Set specific image tags in compose files
  38. #
  39. sed -i "" -e "s/unstable/${VERSION}/" *.yml
  40. # Commit all changes and tag the repo
  41. #
  42. git commit -a -m "release: ${VERSION}" -m "${CHANGES}"
  43. git tag -a "${VERSION}" -m "release" -m "${CHANGES}"
  44. # Revert back to "unstable" for development
  45. #
  46. sed -i "" -e "s/${VERSION}/unstable/" *.yml
  47. git commit -a -m "misc: working on unstable"
  48. # Push all changes and tags
  49. #
  50. git push
  51. git push --tags