File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- #! /usr/ bin/env bash
1+ #! /bin/bash
22# Edit the version string in the gemspec, then execute this script to:
33#
44# 1. Commit the version change
55# 2. Tag the release
66# 3. Push the tag and the current branch to GitHub
77# 4. Publish the gem to RubyGems
88#
9- set -e
9+ set -eu
1010
11- gem build * .gemspec | awk ' /Name:|Version:|File:/ { print $2 }' | xargs | {
12- read gem_name gem_version gem_file
13- trap " rm -rf $gem_file " INT EXIT
11+ fields=( $( gem build * .gemspec | awk ' /Name:|Version:/ {print $2}' ) )
12+ name=" ${fields[0]} "
13+ version=" ${fields[1]} "
14+ gem=" ${name} -${version} .gem"
15+ [ -n " $version " ] || exit 1
16+ trap " rm -f '$gem '" EXIT
1417
15- bundle install
16- script/test
18+ bundle install
19+ script/test
1720
18- git commit -m " $gem_name $gem_version " -- * .gemspec Gemfile*
19- git tag " v${gem_version} "
21+ if ! git rev-parse --verify --quiet " refs/tags/v${version} " > /dev/null; then
22+ git commit --allow-empty -a -m " $name $version "
23+ git tag " v${version} "
24+ fi
2025
21- git push origin HEAD " v${gem_version} "
22- gem push " $gem_file "
23- }
26+ git push origin HEAD " v${version} "
27+ gem push " $gem "
You can’t perform that action at this time.
0 commit comments