checkr/checkr-ruby

View on GitHub
bin/release

Summary

Maintainability
Test Coverage
#!/usr/bin/env bash
# Usage: bin/release
# Build the gem, tag master, push it to origin, and then release the package on RubyGems.

set -e

branch="$(git rev-parse --abbrev-ref HEAD)"
[ "$branch" = "master" ] ||
  (echo "You are not on master. First push your branch, get your PR reviewed, merge it on Github. "\
    "Then locally move to master and pull last changes." && exit 1)

version="$(gem build *.gemspec | grep Version: | awk '{print $2}')"
[ -n "$version" ] || (echo "Version needs to be a number" && exit 1)

echo $version
git tag "v$version"
git push origin "v$version"
gem push *-${version}.gem