release.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/env bash
  2. set -e
  3. # Make sure the release tag is provided.
  4. if (( "$#" != 1 ))
  5. then
  6. echo "Tag has to be provided."
  7. exit 1
  8. fi
  9. RELEASE_BRANCH="8.x"
  10. CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
  11. VERSION=$1
  12. # Make sure current branch and release branch match.
  13. if [[ "$RELEASE_BRANCH" != "$CURRENT_BRANCH" ]]
  14. then
  15. echo "Release branch ($RELEASE_BRANCH) does not match the current active branch ($CURRENT_BRANCH)."
  16. exit 1
  17. fi
  18. # Make sure the working directory is clear.
  19. if [[ ! -z "$(git status --porcelain)" ]]
  20. then
  21. echo "Your working directory is dirty. Did you forget to commit your changes?"
  22. exit 1
  23. fi
  24. # Make sure latest changes are fetched first.
  25. git fetch origin
  26. # Make sure that release branch is in sync with origin.
  27. if [[ $(git rev-parse HEAD) != $(git rev-parse origin/$RELEASE_BRANCH) ]]
  28. then
  29. echo "Your branch is out of date with its upstream. Did you forget to pull or push any changes before releasing?"
  30. exit 1
  31. fi
  32. # Always prepend with "v"
  33. if [[ $VERSION != v* ]]
  34. then
  35. VERSION="v$VERSION"
  36. fi
  37. # Tag Framework
  38. git tag $VERSION
  39. git push origin --tags
  40. # Tag Components
  41. for REMOTE in auth broadcasting bus cache collections config console container contracts cookie database encryption events filesystem hashing http log macroable mail notifications pagination pipeline queue redis routing session support testing translation validation view
  42. do
  43. echo ""
  44. echo ""
  45. echo "Releasing $REMOTE";
  46. TMP_DIR="/tmp/laravel-split"
  47. REMOTE_URL="git@github.com:illuminate/$REMOTE.git"
  48. rm -rf $TMP_DIR;
  49. mkdir $TMP_DIR;
  50. (
  51. cd $TMP_DIR;
  52. git clone $REMOTE_URL .
  53. git checkout "$RELEASE_BRANCH";
  54. git tag $VERSION
  55. git push origin --tags
  56. )
  57. done