2018-11-24 07:52:02 -08:00

106 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
## Build the distributable repo branches
. admin/config
#---------------------------------------------------
# Sanity check - are we underway already?
if [ "$BRANCH" ]; then
echo -e "${BOLD}${ERROR}No release build is underway${NORMAL}"
exit 1
fi
#---------------------------------------------------
# Setup variables
UPSTREAM=${CI_ORG}CodeIgniter4.git
action=test
version=4
qualifier=
branch=post-release-
devonly='.github/* admin/* build/* contributing/* user_guide_src/* CODE_OF_CONDUCT.md \
DCO.txt PULL_REQUEST_TEMPLATE.md'
which=release
BOLD='\033[1m'
NORMAL='\033[0m'
COLOR='\033[1;31m'
ERROR='\033[0;31m'
echo -e "${BOLD}${COLOR}CodeIgniter4 release cleanup${NORMAL}"
echo '----------------------------'
#---------------------------------------------------
# Check arguments
echo -e "${BOLD}Checking arguments...${NORMAL}"
if [ $# -lt 1 ]; then
echo "You really need to read the directions first!"
exit 1
fi
version=$1
if [ $# -gt 1 ]; then
qualifier="-${2}"
which='pre-release'
fi
release_branch="release-$version$qualifier"
branch="post-${release_branch}"
#---------------------------------------------------
# Create the post-release branch
echo -e "${BOLD}Creating $branch${NORMAL}"
git checkout $release_branch
git branch -d $branch # remove the branch if there
git checkout -b $branch
#---------------------------------------------------
# Put our house back in order
echo -e "${BOLD}Put our house back in order${NORMAL}"
mv -r admin/previous-gitignore .gitignore
rm -Rf docs
#---------------------------------------------------
# Add next version block in changelog.rst
echo -e "${BOLD}Setup next release${NORMAL}"
sed -i '5 i\
Version |release|
====================================================
Release Date: Not Released
' user_guide_src/source/changelog.rst
git add .
git commit -S -m "Post ${branch} cleanup"
#---------------------------------------------------
# Cleanup master
echo -e "${BOLD}Cleanup the master branch${NORMAL}"
git checkout master
git merge ${branch}
git push origin master
#git push UPSTREAM master
#---------------------------------------------------
# Cleanup develop
echo -e "${BOLD}Cleanup the develop branch${NORMAL}"
git checkout develop
git merge ${branch}
git push origin develop
#git push UPSTREAM develop
# keep or delete the release branch? up to you
# at this point, you should have uptodate develop and master,
# as well as the release and post-release branches
#---------------------------------------------------
# Phew!
echo -e "${BOLD}Congratulations - we have liftoff${NORMAL}"
echo "Don't forget to announce this release on the forum and on twitter!"