| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #!/bin/bash
- #
- # Prepare a new release branch
- #
- . "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
- function usage() {
- >&2 cat << EOM
- Create a new release branch 'release-<version>'
- 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
- }
- [ -n "$1" ] || usage
- VERSION=$1
- BRANCH=bump-$VERSION
- REPO=docker/compose
- [email protected]:$REPO
- if [ -z "$2" ]; then
- BASE_VERSION="master"
- else
- BASE_VERSION=$2
- fi
- DEFAULT_REMOTE=release
- REMOTE="$(find_remote "$GITHUB_REPO")"
- # If we don't have a docker remote add one
- if [ -z "$REMOTE" ]; then
- echo "Creating $DEFAULT_REMOTE remote"
- git remote add ${DEFAULT_REMOTE} ${GITHUB_REPO}
- fi
- # handle the difference between a branch and a tag
- if [ -z "$(git name-rev --tags $BASE_VERSION | grep tags)" ]; then
- 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
- echo "Merging remote release branch into new release branch"
- git merge --strategy=ours --no-edit $REMOTE/release
- # Store the release version for this branch in git, so that other release
- # scripts can use it
- git config "branch.${BRANCH}.release" $VERSION
- editor=${EDITOR:-vim}
- echo "Update versions in compose/__init__.py, script/run/run.sh"
- $editor compose/__init__.py
- $editor script/run/run.sh
- 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
- echo "Verify changes before commit. Exit the shell to commit changes"
- $SHELL || true
- git commit -a -m "Bump $VERSION" --signoff --no-verify
- echo "Push branch to docker remote"
- git push $REMOTE
- browser https://github.com/$REPO/compare/docker:release...$BRANCH?expand=1
|