codeclimate/python-test-reporter

View on GitHub
bin/prep-release

Summary

Maintainability
Test Coverage
#!/bin/sh
#
# Open a PR for releasing a new version of this repository.
#
# Usage: bin/prep-release VERSION
#
###
set -e

if [ -z "$1" ]; then
  echo "usage: bin/prep-release VERSION" >&2
  exit 64
fi

version=$1
old_version=$(< codeclimate_test_reporter/VERSION)
branch="release-$version"

if ! make test; then
  echo "test failure, not releasing" >&2
  exit 1
fi

printf "RELEASE %s => %s\n" "$old_version" "$version"
git checkout master
git pull origin master

git checkout -b "$branch"

printf "%s\n" "$version" > codeclimate_test_reporter/VERSION
git add codeclimate_test_reporter/VERSION
git commit -m "Release v$version"
git push origin "$branch"

branch_head=$(git rev-parse --short $branch)
if command -v hub > /dev/null 2>&1; then
  hub pull-request -F - <<EOF
Release v$version

https://github.com/codeclimate/python-test-reporter/compare/v$old_version...$branch_head
EOF
else
  echo "hub not installed? Please open the PR manually" >&2
fi

echo "After merging the version-bump PR, run: make release"