File: release

package info (click to toggle)
ruby-version-sorter 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 172 kB
  • sloc: ansic: 248; ruby: 147; sh: 52; makefile: 8
file content (27 lines) | stat: -rwxr-xr-x 662 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Edit the version string in the gemspec, then execute this script to:
#
# 1. Commit the version change
# 2. Tag the release
# 3. Push the tag and the current branch to GitHub
# 4. Publish the gem to RubyGems
#
set -eu

fields=( $(gem build *.gemspec | awk '/Name:|Version:/ {print $2}') )
name="${fields[0]}"
version="${fields[1]}"
gem="${name}-${version}.gem"
[ -n "$version" ] || exit 1
trap "rm -f '$gem'" EXIT

bundle install
script/test

if ! git rev-parse --verify --quiet "refs/tags/v${version}" >/dev/null; then
  git commit --allow-empty -a -m "$name $version"
  git tag "v${version}"
fi

git push origin HEAD "v${version}"
gem push "$gem"