Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaking the release builder #1246

Merged
merged 2 commits into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/docbot.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ If "deploy" is not added, the script execution is considered
a trial run, and nothing is pushed to the repo.

Whether or not deployed, the results are left inside
user_guide_src/build
user_guide_src/build (which is git ignored).
84 changes: 84 additions & 0 deletions admin/post_release
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#~/bin/bash

## Cleanup after a framework release

UPSTREAM=https://github.com/bcit-ci/CodeIgniter4.git
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

#---------------------------------------------------
# Merge away
echo -e "${BOLD}Setup the develop branch${NORMAL}"
git add .
git commit -S -m "Post ${branch} cleanup"
git push origin master
git push UPSTREAM master

git checkout develop
git merge ${branch}
git push origin develop
git push UPSTREAM develop

# keep or delete the release branch? up to you
#git branch -d $branch

#---------------------------------------------------
# Phew!

echo -e "${BOLD}Congratulations - we have liftoff${NORMAL}"
echo "Don't forget to announce this release on the forum and on twitter!"
80 changes: 10 additions & 70 deletions admin/release
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#~/bin/bash

## Build and deploy framework release
## Build a framework release branch

#---------------------------------------------------
# Setup variables

UPSTREAM=https://github.com/bcit-ci/CodeIgniter4.git
action=test
Expand All @@ -25,17 +28,10 @@ echo '----------------------------'
echo -e "${BOLD}Checking arguments...${NORMAL}"

if [ $# -lt 1 ]; then
echo "You really need to read the directions first!"
echo -e "${BOLD}Usage: admin/release version# pre-release-qualifier${NORMAL}"
exit 1
fi

if [ $1 = 'deploy' ]; then
action=deploy
elif [ $1 != 'test' ]; then
echo -e "${ERROR}Invalid action ($1)${NORMAL}"
exit 1
fi
shift # drop the command from the argument list

version=$1
if [ $# -gt 1 ]; then
Expand Down Expand Up @@ -89,6 +85,7 @@ cd user_guide_src
make html
rm -Rf ../docs
mv build/html ../docs
touch ../docs/.nojekyll

# make the epub, but leave it inside the gitignored user_guide_src to deal with separately
make epub
Expand All @@ -111,69 +108,12 @@ for f in $devonly; do
done

#---------------------------------------------------
# And finally, the release tag
echo -e "${BOLD}Tag this branch for release${NORMAL}"
# And finally, get ready for merging
git add .
git commit -m "Release ${version}${qualifier}"
git tag -a v${version}${qualifier} -m "Release ${version}${qualifier} build"

#---------------------------------------------------
# Are we there yet?
if [ $action = 'test' ]; then
echo -e "${BOLD}Your $branch branch is ready to inspect.${NORMAL}"
exit 0
fi
echo -e "${BOLD}Are we there yet (yes|no)?${NORMAL}"
read answer
if [ $answer != 'yes' ]; then
echo -e "${BOLD}Your $branch branch is ready to inspect.${NORMAL}"
echo "Rerun this script when ready to deploy"
exit 1
fi

#---------------------------------------------------
# Merge away
echo -e "${BOLD}Merge the release into master${NORMAL}"
git checkout master
git merge $branch
git push UPSTREAM master
git push UPSTREAM --tags

#---------------------------------------------------
# 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

#---------------------------------------------------
# Merge away
echo -e "${BOLD}Setup the develop branch${NORMAL}"
git add .
git commit -S -m "Post ${branch} cleanup"
git push origin master
git push UPSTREAM master

git checkout develop
git merge master
git push origin develop
git push UPSTREAM develop

# keep or delete the release branch? up to you
#git branch -d $branch

#---------------------------------------------------
# Phew!

echo -e "${BOLD}Congratulations - we have liftoff${NORMAL}"
echo "Don't forget to announce this release on the forum and on twitter!"
# Done for now
echo -e "${BOLD}Your $branch branch is ready to inspect.${NORMAL}"
echo -e "${BOLD}Follow the directions in release.md to continue.${NORMAL}"
47 changes: 30 additions & 17 deletions admin/release.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# release

Builds & deploys a framework release.
Builds the branches needed for a framework release.

This tool is meant to help automate the process of
launching a new release, by creating the release
distribution files, tagging everything properly,
and getting the repo branches in order.
distribution files, (tagging everything properly),
and getting/keeping the repo branches in order.

## Audience

Expand All @@ -22,24 +22,29 @@ There might be other feature branches, but they are not relevant to this process

Once "develop" is ready for a new release, the general workflow is to

- create a release branch from develop
- create a "release" branch from develop
- update version dependencies or constants
- generate version(s) of the user guide
- move or ignore stuff, distinguishing release from development
- test that all is as it should be
- tag and merge the release branch into "master"
- merge "master" into "develop"
- merge the release branch into "master"
- **manually** create the release & tag on github, based on master
- put everything back where it should be for development
- remove the release branch
- merge the post-release branch into "master"
- merge the post-release branch into "develop"
- **manually** delete the release branches in the repo
- **manually** post a sticky announcement thread on the forum
- **manually** tweet the release announcement

Visually:

develop -> release -> master -> develop
develop -> release -> master
post-release -> master
post->release -> develop

Finally, there are a couple of manual tasks:

- post a sticky announcement thread on the forum
- tweet the release announcement
The `release` bash script does the first six workflow steps,
and the `post-release` script does the other three between
the manual steps.

## Assumptions

Expand All @@ -61,11 +66,10 @@ as part of a bug fix minor release.

Inside a shell prompt, in the project root:

`admin/release [test|deploy] version [qualifier]`
`admin/release version [qualifier]`

If the "deploy" action is not specified, the script execution is considered
a trial run, and nothing is pushed to the repo.
Whether or not deployed, the results are left inside
Nothing is pushed to the repo. at this point -
the results are left inside
the release branch in your local clone.

The "version" should follow semantic versioning, e.g. `4.0.6`, and the
Expand All @@ -75,7 +79,16 @@ The "qualifier" argument is a suffix to add to the version
for a pre-release, e.g. `beta.2` or `rc.41`.

Examples:
- `admin/release test 4.0.0 alpha.1` would prepare the "4.0.0-alpha.1" pre-release PR
- `admin/release 4.0.0 alpha.1` would prepare the "4.0.0-alpha.1" pre-release PR
- `admin/release 4.0.0` would prepare the "4.0.0" release PR
- `admin/release peanut butter banana` would complain and tell you to read these directions

Complete the next few steps of the release manually:
- merge the release branch to "master"
- push that to the main repo
- on github.com, create an appropriate release (or pre-release)

Once the release branch has been vetted, and you have
completed the manual steps, clean up with:

`admin/post_release`