Skip to content

Commit 7df1df2

Browse files
committed
Add release script
1 parent 9be73b1 commit 7df1df2

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

script/release

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Edit the version string in the gemspec, then execute this script to:
3+
#
4+
# 1. Commit the version change
5+
# 2. Tag the release
6+
# 3. Push the tag and the current branch to GitHub
7+
# 4. Publish the gem to RubyGems
8+
#
9+
set -eu
10+
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
17+
18+
bundle install
19+
script/test
20+
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
25+
26+
git push origin HEAD "v${version}"
27+
gem push "$gem"

0 commit comments

Comments
 (0)