File: release

package info (click to toggle)
ruby-scientist 1.6.5-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 292 kB
  • sloc: ruby: 1,239; sh: 23; makefile: 4
file content (38 lines) | stat: -rwxr-xr-x 731 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
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# Tag and push a release.

set -e

# Make sure we're in the project root.

cd $(dirname "$0")/..

# Build a new gem archive.

rm -rf scientist-*.gem
gem build -q scientist.gemspec

# Make sure we're on the main branch.

(git branch --no-color | grep -q '* main') || {
  echo "Only release from the main branch."
  exit 1
}

# Figure out what version we're releasing.

tag=v`ls scientist-*.gem | sed 's/^scientist-\(.*\)\.gem$/\1/'`

# Make sure we haven't released this version before.

git fetch -t origin

(git tag -l | grep -q "$tag") && {
  echo "Whoops, there's already a '${tag}' tag."
  exit 1
}

# Tag it and bag it.

gem push scientist-*.gem && git tag "$tag" &&
  git push origin main && git push origin "$tag"