You are here

release-branch.sh in Lightning Core 8.4

#!/bin/bash

set -e

# Prepares a release branch.
# Example usage: DB_URL=mysql://user:password@server/db ./release-branch.sh 3.12.0

RELEASE_BRANCH=release/$1

# Ensure we are on a mainline release branch.
BRANCH=$(git rev-parse --abbrev-ref HEAD)

if [[ $BRANCH =~ ^8\.x\-[0-9]+\.x$ ]]; then
  CHANGE_LOG=logs/$1.md

  if [[ ! -f $CHANGE_LOG ]]; then
    echo "$CHANGE_LOG must exist before creating a release branch."
    exit 1
  fi

  git pull
  git fetch origin --tags
  git checkout -b $RELEASE_BRANCH

  cd logs
  ./generate.sh > ../CHANGELOG.md
  cd ..

  composer update
  cp composer.lock tests/fixtures/$1.lock

  git add .
  git commit --quiet --message "$1 Release"
  git push --set-upstream origin $RELEASE_BRANCH
else
  echo "This can only be done from a mainline release branch, e.g. 8.x-4.x."
  exit 1
fi

File

release-branch.sh
View source
  1. #!/bin/bash
  2. set -e
  3. # Prepares a release branch.
  4. # Example usage: DB_URL=mysql://user:password@server/db ./release-branch.sh 3.12.0
  5. RELEASE_BRANCH=release/$1
  6. # Ensure we are on a mainline release branch.
  7. BRANCH=$(git rev-parse --abbrev-ref HEAD)
  8. if [[ $BRANCH =~ ^8\.x\-[0-9]+\.x$ ]]; then
  9. CHANGE_LOG=logs/$1.md
  10. if [[ ! -f $CHANGE_LOG ]]; then
  11. echo "$CHANGE_LOG must exist before creating a release branch."
  12. exit 1
  13. fi
  14. git pull
  15. git fetch origin --tags
  16. git checkout -b $RELEASE_BRANCH
  17. cd logs
  18. ./generate.sh > ../CHANGELOG.md
  19. cd ..
  20. composer update
  21. cp composer.lock tests/fixtures/$1.lock
  22. git add .
  23. git commit --quiet --message "$1 Release"
  24. git push --set-upstream origin $RELEASE_BRANCH
  25. else
  26. echo "This can only be done from a mainline release branch, e.g. 8.x-4.x."
  27. exit 1
  28. fi