codeclimate/test-reporter

View on GitHub
release-scripts/prep-release

Summary

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

set -e

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

./release-scripts/validate-release

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


printf "RELEASE %s => %s\n" "$old_version" "$version"
git fetch origin master
git reset --hard origin/master

git checkout -b "$branch"

printf "%s\n" "$version" > VERSIONING/VERSION
git add VERSIONING/VERSION
git commit --message "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/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 release-scripts/release"