2015-09-11 07:44:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Prepare a new release branch
|
|
|
|
#
|
|
|
|
|
2015-09-22 16:10:11 +02:00
|
|
|
. "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
|
2015-09-11 07:44:25 +02:00
|
|
|
|
|
|
|
function usage() {
|
|
|
|
>&2 cat << EOM
|
2015-09-22 16:10:11 +02:00
|
|
|
Create a new release branch 'release-<version>'
|
2015-09-11 07:44:25 +02:00
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
$0 <version> [<base_version>]
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
|
|
|
version version string for the release (ex: 1.6.0)
|
|
|
|
base_version branch or tag to start from. Defaults to master. For
|
|
|
|
bug-fix releases use the previous stage release tag.
|
|
|
|
|
|
|
|
EOM
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2015-09-22 16:10:11 +02:00
|
|
|
|
2015-09-11 07:44:25 +02:00
|
|
|
[ -n "$1" ] || usage
|
|
|
|
VERSION=$1
|
|
|
|
BRANCH=bump-$VERSION
|
2015-09-22 16:10:11 +02:00
|
|
|
REPO=docker/compose
|
|
|
|
GITHUB_REPO=git@github.com:$REPO
|
2015-09-11 07:44:25 +02:00
|
|
|
|
|
|
|
if [ -z "$2" ]; then
|
|
|
|
BASE_VERSION="master"
|
|
|
|
else
|
|
|
|
BASE_VERSION=$2
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
DEFAULT_REMOTE=release
|
2015-09-22 16:10:11 +02:00
|
|
|
REMOTE="$(find_remote "$GITHUB_REPO")"
|
2015-10-14 21:20:57 +02:00
|
|
|
# If we don't have a docker remote add one
|
2015-09-11 07:44:25 +02:00
|
|
|
if [ -z "$REMOTE" ]; then
|
|
|
|
echo "Creating $DEFAULT_REMOTE remote"
|
2015-09-22 16:10:11 +02:00
|
|
|
git remote add ${DEFAULT_REMOTE} ${GITHUB_REPO}
|
2015-09-11 07:44:25 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# handle the difference between a branch and a tag
|
2015-10-16 18:54:31 +02:00
|
|
|
if [ -z "$(git name-rev --tags $BASE_VERSION | grep tags)" ]; then
|
2015-09-11 07:44:25 +02:00
|
|
|
BASE_VERSION=$REMOTE/$BASE_VERSION
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Creating a release branch $VERSION from $BASE_VERSION"
|
|
|
|
read -n1 -r -p "Continue? (ctrl+c to cancel)"
|
|
|
|
git fetch $REMOTE -p
|
|
|
|
git checkout -b $BRANCH $BASE_VERSION
|
|
|
|
|
2015-10-14 21:20:57 +02:00
|
|
|
echo "Merging remote release branch into new release branch"
|
|
|
|
git merge --strategy=ours --no-edit $REMOTE/release
|
2015-09-11 07:44:25 +02:00
|
|
|
|
|
|
|
# Store the release version for this branch in git, so that other release
|
|
|
|
# scripts can use it
|
|
|
|
git config "branch.${BRANCH}.release" $VERSION
|
|
|
|
|
|
|
|
|
2015-10-07 17:00:40 +02:00
|
|
|
echo "Update versions in docs/install.md, compose/__init__.py, script/run.sh"
|
2015-09-11 07:44:25 +02:00
|
|
|
$EDITOR docs/install.md
|
|
|
|
$EDITOR compose/__init__.py
|
2015-10-07 17:00:40 +02:00
|
|
|
$EDITOR script/run.sh
|
2015-09-11 07:44:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
echo "Write release notes in CHANGELOG.md"
|
|
|
|
browser "https://github.com/docker/compose/issues?q=milestone%3A$VERSION+is%3Aclosed"
|
|
|
|
$EDITOR CHANGELOG.md
|
|
|
|
|
|
|
|
|
|
|
|
git diff
|
2015-09-22 16:10:11 +02:00
|
|
|
echo "Verify changes before commit. Exit the shell to commit changes"
|
|
|
|
$SHELL || true
|
|
|
|
git commit -a -m "Bump $VERSION" --signoff --no-verify
|
2015-09-11 07:44:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
echo "Push branch to user remote"
|
|
|
|
GITHUB_USER=$USER
|
2015-09-22 16:10:11 +02:00
|
|
|
USER_REMOTE="$(find_remote $GITHUB_USER/compose)"
|
2015-09-11 07:44:25 +02:00
|
|
|
if [ -z "$USER_REMOTE" ]; then
|
|
|
|
echo "No user remote found for $GITHUB_USER"
|
2015-09-22 16:10:11 +02:00
|
|
|
read -r -p "Enter the name of your github user: " GITHUB_USER
|
2015-09-11 07:44:25 +02:00
|
|
|
# assumes there is already a user remote somewhere
|
|
|
|
USER_REMOTE=$(find_remote $GITHUB_USER/compose)
|
|
|
|
fi
|
2015-09-22 16:10:11 +02:00
|
|
|
if [ -z "$USER_REMOTE" ]; then
|
|
|
|
>&2 echo "No user remote found. You need to 'git push' your branch."
|
|
|
|
exit 2
|
|
|
|
fi
|
2015-09-11 07:44:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
git push $USER_REMOTE
|
2015-09-22 16:10:11 +02:00
|
|
|
browser https://github.com/$REPO/compare/docker:release...$GITHUB_USER:$BRANCH?expand=1
|