Sha256: 763e0e5da35a4c34e7b8289259a0d3af1a67283281e7ea0b4fb975d6a2157c53

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

#!/bin/bash -e

git fetch --tags

if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
  echo "Must be on the master branch to releases.  Please switch with 'git checkout master'."
  exit 1
fi

version_file="$(cat lib/conjur-api/version.rb)"
re='VERSION = "([0-9]{1,}\.[0-9]{1,}\.[0-9]{1,})"'
if [[ "$version_file" =~ $re ]]; then
  version="v${BASH_REMATCH[1]}"
else
  echo "Failed to find a version in 'lib/conjur-api/version.rb'"
  exit 1
fi

last_release=$(git describe --abbrev=0 --tags)

echo "The last release was: $last_release"
echo "The next release will be: $version"

if [ "$version" = "$last_release" ]; then
  echo 'To release, the VERSION file must be incremented to the latest release number.'
  exit 1
fi

if [[ ! $(git status --porcelain) ]]; then
  echo 'Your Git is clean. Please update the lib/conjur-api/version.rb, and CHANGELOG.md before releasing.  The script will handle commits and pushing.'
  exit 1
fi

# Make sure we have the most recent changes, without destroying local changes.
git stash
git pull --rebase origin master
git stash pop

# Perform a commit, tag, and push. The tag needs to be present before the commit
# to insure Jenkins has what it needs to make a decision about a release.
git commit -am "$version"
git tag -a "$version" -m "$version release"
git push --follow-tags

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-api-5.3.2 bin/release