File: release

package info (click to toggle)
ruby-octokit 10.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,092 kB
  • sloc: ruby: 13,339; sh: 99; makefile: 7; javascript: 3
file content (53 lines) | stat: -rwxr-xr-x 1,187 bytes parent folder | download
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
# Usage: script/release
# Build the package, tag a commit, push it to origin, and then release the
# package publicly.

set -e

usage() {
  echo "Usage: $0 [-r] Tags and releases/publishes octokit" 1>&2; exit 1;
}

while [ $# -gt 0 ]
do
    case $1 in
        '-r')
            r=true
            ;;
        '-h')
            usage
            ;;
        *)
            echo "No valid parameter passed in, performing a dry run...";
            ;;
    esac
    shift
done

if [ -z "${r}" ]; then
  ./script/package
    echo "*** Dry run: octokit was not tagged or released ***"
    echo -e '☑ success'
else

  # We execite the script separately to get logging and proper exit conditions
  ./script/package

  # We need to pull the version from the actual file that is about to be published
  file=$(ls pkg/*.gem | sort -V | tail -1)
  version=$(echo $file | sed -e 's/.*octokit-\(.*\).gem.*/\1/')

  [ -n "$version" ] || exit 1

  echo "*** Tagging and publishing $version of octokit ***"

  git commit --allow-empty -a -m "v$version"
  git tag "v$version"
  git push origin
  git push origin "v$version"
  gem push pkg/*-${version}.gem
  echo -e '☑ success'
fi